Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Response to the Search API request #882

Merged
merged 8 commits into from
Jun 25, 2020
Merged

Response to the Search API request #882

merged 8 commits into from
Jun 25, 2020

Conversation

arberiii
Copy link
Member

This PR concludes the Search API feature. Since for now, we allow users to search only short links created by them, we first authenticate the user. After that, we retrieve the result from the searcher. The results are formatted into JSON format and the API responds to the client.

@arberiii arberiii added enhancement New feature or request Go Issue requires to write code using Go language labels Jun 25, 2020
@arberiii arberiii self-assigned this Jun 25, 2020
@arberiii arberiii added this to In progress in Search APIs via automation Jun 25, 2020
@codecov
Copy link

codecov bot commented Jun 25, 2020

Codecov Report

Merging #882 into master will decrease coverage by 0.03%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #882      +/-   ##
==========================================
- Coverage   53.65%   53.62%   -0.04%     
==========================================
  Files         132      132              
  Lines        3131     3133       +2     
  Branches      151      151              
==========================================
  Hits         1680     1680              
- Misses       1383     1384       +1     
- Partials       68       69       +1     
Flag Coverage Δ
#golang 70.38% <66.66%> (-0.08%) ⬇️
#typescript 25.53% <ø> (ø)
Impacted Files Coverage Δ
backend/app/usecase/search/search.go 79.41% <66.66%> (-1.59%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8cf0d02...7ca57a9. Read the comment docs.

Copy link
Member

@rohithbalaji123 rohithbalaji123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arberiii , Thanks for working on this interesting PR. I have left few simple suggestions.

backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
Search APIs automation moved this from In progress to Review in progress Jun 25, 2020
@arberiii arberiii changed the title Respond to the Search API request Response to the Search API request Jun 25, 2020
backend/app/adapter/routing/handle/search.go Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
backend/app/adapter/routing/handle/search.go Outdated Show resolved Hide resolved
@arberiii arberiii merged commit 8736177 into master Jun 25, 2020
Search APIs automation moved this from Review in progress to Done Jun 25, 2020
@arberiii arberiii deleted the search-response branch June 25, 2020 18:03
arberiii added a commit that referenced this pull request Jun 25, 2020
* Remove manual string concatenation for reCaptcha API request body (#851)

* Use net/url lib for recaptcha request body

- Also add a test for recaptcha error response

* Apply suggestions from code review

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Check for Has Error in recaptcha test

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Add user permission checks to change log usecases (#859)

* Add permission check for delete change logs

* Add permission check for create change logs

* Add permission check for update change logs

* Add test cases for permission check

* Add authorizer in NewPersist constrictor args

* Add suggestions from code review

* Add shortlink updater interface to use cases (#854)

* Add IsAliasOwnedByUser to UserShortLink interface

* Change UserShortLink interface to include  IsAliasOwnedByUser method
which allows verification of user and alias relationship.

* Fix comparison bug in `func (u *UserFake) CreateUser`.

* Add updater to shortlink use

* Updater adds the ability to mutate short links owned by a user.

* Add unit tests for valid, invalid, and malicious short link updates.

* Replace references to IsAliasOwnedByUser

* Remove references to IsAliasOwnedByUser and replace with HasMapping.

* Replace `found` with idiomatic `ok`.

* Add ErrShortLinkNotFound

* Update ErrShortLinkNotFound go doc

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Cleanup Updater go doc

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Cleanup UpdaterPersist go doc

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Cleanup UpdaterPersist field names

* Change `userShortLinkRelationRepo` to `userShortLinkRepo`

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Cleanup UpdateShortLink go doc

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Rename `ok` to `hasMapping`

* Make variable meaning explicit

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Update malicious long link test name

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Simplify test variable names

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Change expHasErr to expectedHasErr

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Cleanup NewUpdaterPersist variable names

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Update references to old var names

* Remove keygen from UpdaterPersist

* Breakup validation if statements

* Move test data to individual structures

* Move blocked long link to test case data

* Apply suggestions from code review

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Refactor graphQL related schemas into a singe source (#861)

* Refactor graphQL related schemas into a singe source

* Rename Schema.ts to schema.ts

* Update Url.service.ts

* Rename occurences of Schema into schema

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Rename ShortGraphQLService into shortGraphQL (#862)

* Add UpdateTwitterTags to adapter (#850)

* Add UpdateTwitterTags to adapter

* Make small change

* Update backend/app/adapter/sqldb/short_link.go

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Reorder UpdateOpenGraphTags and UpdateTwitterTags

* Update tests

* Format

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Add match package (#864)

* draft matcher

* factor keyword

* document exported types

* replace error format

* comment constants

* rename matcher to match

* fix logic of contains

* rename match type

* fix tests

* remove the interface

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Search Short Link resource (#849)

* unit tests

* implement short link search

* refactor

* refactor filter

* renaming

* check errors seperately

* refactor query match

* refactor short link match

* rename and remove blank lines

* embeed short links into test cases

* refactor match short links

* format search tests

* add test case

* Apply suggestions from code review

* add todos

* go format

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Add api/search route (#867)

* add search api route

* add searcher

* format

* rename config

* format

* format

* search timeout provider

* rename search api

* search provider

* Update backend/dep/provider/search.go

* Update backend/dep/provider/search.go

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* rename netURL package (#868)

* Add constructor for Filter (#870)

* fix bug

* tie order with resource

* filter validation

* hide fields of filter

* format

* rename test

* handle package

* Remove unused obervability package (#874)

* split handlers

* rename handlers

* Remove unnecessary dereference operator (#875)

* Remove unnecessary dereference operator

* Rename ShortLinkSql to ShortLinkSQL

* Fix integration test

* Update backend/app/adapter/sqldb/short_link.go

Co-authored-by: Arber Avdullahu <arber_919@live.com>

Co-authored-by: Arber Avdullahu <arber_919@live.com>

* Add update short link api (#876)

* Move args closer to its consumer

* Add update short link API

* Fix unit tests

* Parse search API request (#878)

* parse user

* read request draft

* authenticate user

* format

* unmarshal search request

* change comment

* add comment

* unmarshal filter

* format

* Refactored search API parsing

* Clean up

* Clean up

* fix comment

* comment constants

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Effectual assignments in Go code and constant comments  (#881)

* assign err

* fix comments

* address review

* Add MetaTagPersist to usecase (#871)

* Add MetaTagPersist

* Apply suggestions from code review

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Make code review changes

* Make code review changes

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

* Response to the Search API request (#882)

* respond

* rename respond body

* address comments

* change maxResult logic

* format

* rename constructors

Co-authored-by: Harry Liu <byliuyang11@gmail.com>

Co-authored-by: James Cote <3276350+Coteh@users.noreply.github.com>
Co-authored-by: Rohith Balaji <rohithbalaji123@gmail.com>
Co-authored-by: Oscar Tovar <33381041+oatovar@users.noreply.github.com>
Co-authored-by: Kapil Lamba <kapillamba4@gmail.com>
Co-authored-by: Arber Avdullahu <arber_919@live.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request Go Issue requires to write code using Go language size/L
Projects
No open projects
Search APIs
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants