Monorepo for Tangled tangled.org

draft: appview: service layer #800

open opened by boltless.me targeting master from sl/uvpzuszrulvq

Obviously file naming of appview/web/handler/*.go files are directly against to go convention. Though I think flattening all handler files can significantly reduce the effort involved in file naming and structuring. We are already grouping core services by domains, and doing same for web handers is just over-complicating.

Signed-off-by: Seongmin Lee git@boltless.me

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:xasnlahkri4ewmbuzly2rlc5/sh.tangled.repo.pull/3m5jyyj76xa22
+51 -13
Interdiff #13 #14
appview/oauth/handler.go

This patch was likely rebased, as context lines do not match.

appview/service/issue/errors.go

This file has not been changed.

+11 -6
appview/service/issue/issue.go
··· 129 129 130 130 var issues []models.Issue 131 131 var err error 132 - if searchOpts.Keyword != "" { 132 + if searchOpts.HasSearchFilters() { 133 133 res, err := s.indexer.Search(ctx, searchOpts) 134 134 if err != nil { 135 135 l.Error("failed to search for issues", "err", err) ··· 142 142 return nil, ErrDatabaseFail 143 143 } 144 144 } else { 145 - openInt := 0 146 - if searchOpts.IsOpen { 147 - openInt = 1 145 + filters := []orm.Filter{ 146 + orm.FilterEq("repo_at", repo.RepoAt()), 147 + } 148 + if searchOpts.IsOpen != nil { 149 + openInt := 0 150 + if *searchOpts.IsOpen { 151 + openInt = 1 152 + } 153 + filters = append(filters, orm.FilterEq("open", openInt)) 148 154 } 149 155 issues, err = db.GetIssuesPaginated( 150 156 s.db, 151 157 searchOpts.Page, 152 - orm.FilterEq("repo_at", repo.RepoAt()), 153 - orm.FilterEq("open", openInt), 158 + filters..., 154 159 ) 155 160 if err != nil { 156 161 l.Error("failed to get issues", "err", err)
appview/service/issue/state.go

This file has not been changed.

appview/service/repo/errors.go

This file has not been changed.

appview/service/repo/repo.go

This file has not been changed.

appview/service/repo/repoinfo.go

This file has not been changed.

appview/session/context.go

This file has not been changed.

appview/session/session.go

This file has not been changed.

appview/state/legacy_bridge.go

This file has not been changed.

appview/web/handler/oauth.go

This file has not been changed.

+40 -7
appview/web/handler/user_repo_issues.go
··· 11 11 "tangled.org/core/appview/pages" 12 12 "tangled.org/core/appview/pagination" 13 13 "tangled.org/core/appview/reporesolver" 14 + "tangled.org/core/appview/searchquery" 14 15 isvc "tangled.org/core/appview/service/issue" 15 16 rsvc "tangled.org/core/appview/service/repo" 16 17 "tangled.org/core/appview/session" ··· 36 37 return 37 38 } 38 39 39 - query := r.URL.Query() 40 + params := r.URL.Query() 41 + page := pagination.FromContext(r.Context()) 42 + 43 + query := searchquery.Parse(params.Get("q")) 44 + 45 + // resolve := func(ctx context.Context, ident string) (string, error) { 46 + // id, err := s.idResolver.ResolveIdent(ctx, ident) 47 + // if err != nil { 48 + // return "", err 49 + // } 50 + // return id.DID.String(), nil 51 + // } 52 + 53 + // authorDid, negatedAuthorDids := searchquery.ResolveAuthor(r.Context(), query, resolve, l) 54 + 55 + labels := query.GetAll("label") 56 + negatedLabels := query.GetAllNegated("label") 57 + labelValues := query.GetDynamicTags() 58 + negatedLabelValues := query.GetNegatedDynamicTags() 59 + 60 + tf := searchquery.ExtractTextFilters(query) 61 + 62 + isOpen := true 63 + 40 64 searchOpts := models.IssueSearchOptions{ 41 - RepoAt: repo.RepoAt().String(), 42 - Keyword: query.Get("q"), 43 - IsOpen: query.Get("state") != "closed", 44 - Page: pagination.FromContext(ctx), 65 + Keywords: tf.Keywords, 66 + Phrases: tf.Phrases, 67 + RepoAt: repo.RepoAt().String(), 68 + IsOpen: &isOpen, 69 + AuthorDid: "", 70 + Labels: labels, 71 + LabelValues: labelValues, 72 + NegatedKeywords: tf.NegatedKeywords, 73 + NegatedPhrases: tf.NegatedPhrases, 74 + NegatedLabels: negatedLabels, 75 + NegatedLabelValues: negatedLabelValues, 76 + NegatedAuthorDids: nil, 77 + Page: page, 45 78 } 46 79 47 80 issues, err := is.GetIssues(ctx, repo, searchOpts) ··· 71 104 72 105 Issues: issues, 73 106 LabelDefs: defs, 74 - FilteringByOpen: searchOpts.IsOpen, 75 - FilterQuery: searchOpts.Keyword, 107 + FilterState: "open", 108 + FilterQuery: query.String(), 76 109 Page: searchOpts.Page, 77 110 }) 78 111 }()
appview/web/middleware/auth.go

This file has not been changed.

appview/web/middleware/ensuredidorhandle.go

This file has not been changed.

appview/web/middleware/log.go

This file has not been changed.

appview/web/middleware/middleware.go

This file has not been changed.

appview/web/middleware/normalize.go

This file has not been changed.

appview/web/middleware/paginate.go

This file has not been changed.

appview/web/middleware/resolve.go

This file has not been changed.

appview/web/readme.md

This file has not been changed.

appview/web/request/context.go

This file has not been changed.

appview/web/routes.go

This file has not been changed.

cmd/appview/main.go

This file has not been changed.

History

20 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
wip: appview/{service,web}: service layer
1/3 failed, 2/3 timeout
expand
no conflicts, ready to merge
expand 0 comments
1 commit
expand
wip: appview/{service,web}: service layer
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
wip: appview/{service,web}: service layer
3/3 failed
expand
expand 0 comments
1 commit
expand
wip: appview/{service,web}: service layer
3/3 failed
expand
expand 0 comments
1 commit
expand
wip: appview/{service,web}: service layer
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
wip: appview/{service,web}: service layer
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
appview/{service,web}: service layer
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
appview/{service,web}: service layer
1/3 failed, 2/3 success
expand
expand 0 comments
1 commit
expand
appview/{service,web}: service layer
3/3 failed
expand
expand 0 comments
1 commit
expand
appview/{service,web}: service layer
3/3 success
expand
expand 0 comments
1 commit
expand
appview/{service,web}: service layer
2/3 failed, 1/3 success
expand
expand 0 comments
1 commit
expand
appview/{service,web}: service layer
3/3 success
expand
expand 0 comments
1 commit
expand
appview/{service,web}: service layer
1/3 failed, 2/3 timeout
expand
expand 0 comments
1 commit
expand
draft: appview/service: service layer
3/3 success
expand
expand 0 comments
1 commit
expand
draft: appview/service: service layer
1/3 failed, 1/3 timeout, 1/3 success
expand
expand 0 comments
1 commit
expand
draft: appview/service: service layer
3/3 success
expand
expand 0 comments
1 commit
expand
draft: appview/service: service layer
3/3 success
expand
expand 0 comments
1 commit
expand
draft: appview/service: service layer
3/3 success
expand
expand 0 comments
1 commit
expand
draft: appview: service layer
3/3 failed
expand
expand 0 comments
1 commit
expand
draft: appview: service layer
3/3 failed
expand
expand 0 comments