this repo has no description

apview: replace all use of `db.Repo.AtUri` with `db.Repo.RepoAt()`

Signed-off-by: Seongmin Lee <boltlessengineer@proton.me>

authored by Seongmin Lee and committed by Tangled f2767b97 b7861a9d

Changed files
+10 -14
appview
db
pulls
repo
state
+7 -4
appview/db/repos.go
··· 391 var description, spindle sql.NullString 392 393 row := e.QueryRow(` 394 - select did, name, knot, created, at_uri, description, spindle 395 from repos 396 where did = ? and name = ? 397 `, ··· 400 ) 401 402 var createdAt string 403 - if err := row.Scan(&repo.Did, &repo.Name, &repo.Knot, &createdAt, &repo.AtUri, &description, &spindle); err != nil { 404 return nil, err 405 } 406 createdAtTime, _ := time.Parse(time.RFC3339, createdAt) ··· 421 var repo Repo 422 var nullableDescription sql.NullString 423 424 - row := e.QueryRow(`select did, name, knot, created, at_uri, description from repos where at_uri = ?`, atUri) 425 426 var createdAt string 427 - if err := row.Scan(&repo.Did, &repo.Name, &repo.Knot, &createdAt, &repo.AtUri, &nullableDescription); err != nil { 428 return nil, err 429 } 430 createdAtTime, _ := time.Parse(time.RFC3339, createdAt) ··· 440 } 441 442 func AddRepo(e Execer, repo *Repo) error { 443 _, err := e.Exec( 444 `insert into repos 445 (did, name, knot, rkey, at_uri, description, source)
··· 391 var description, spindle sql.NullString 392 393 row := e.QueryRow(` 394 + select did, name, knot, created, at_uri, description, spindle, rkey 395 from repos 396 where did = ? and name = ? 397 `, ··· 400 ) 401 402 var createdAt string 403 + if err := row.Scan(&repo.Did, &repo.Name, &repo.Knot, &createdAt, &repo.AtUri, &description, &spindle, &repo.Rkey); err != nil { 404 return nil, err 405 } 406 createdAtTime, _ := time.Parse(time.RFC3339, createdAt) ··· 421 var repo Repo 422 var nullableDescription sql.NullString 423 424 + row := e.QueryRow(`select did, name, knot, created, at_uri, rkey, description from repos where at_uri = ?`, atUri) 425 426 var createdAt string 427 + if err := row.Scan(&repo.Did, &repo.Name, &repo.Knot, &createdAt, &repo.AtUri, &repo.Rkey, &nullableDescription); err != nil { 428 return nil, err 429 } 430 createdAtTime, _ := time.Parse(time.RFC3339, createdAt) ··· 440 } 441 442 func AddRepo(e Execer, repo *Repo) error { 443 + if repo.AtUri == "" { 444 + repo.AtUri = repo.RepoAt().String() 445 + } 446 _, err := e.Exec( 447 `insert into repos 448 (did, name, knot, rkey, at_uri, description, source)
+3 -8
appview/pulls/pulls.go
··· 28 29 "github.com/bluekeyes/go-gitdiff/gitdiff" 30 comatproto "github.com/bluesky-social/indigo/api/atproto" 31 - "github.com/bluesky-social/indigo/atproto/syntax" 32 lexutil "github.com/bluesky-social/indigo/lex/util" 33 "github.com/go-chi/chi/v5" 34 "github.com/google/uuid" ··· 918 return 919 } 920 921 - forkAtUri, err := syntax.ParseATURI(fork.AtUri) 922 - if err != nil { 923 - log.Println("failed to parse fork AT URI", err) 924 - s.pages.Notice(w, "pull", "Failed to create pull request. Try again later.") 925 - return 926 - } 927 928 pullSource := &db.PullSource{ 929 Branch: sourceBranch, ··· 931 } 932 recordPullSource := &tangled.RepoPull_Source{ 933 Branch: sourceBranch, 934 - Repo: &fork.AtUri, 935 Sha: sourceRev, 936 } 937
··· 28 29 "github.com/bluekeyes/go-gitdiff/gitdiff" 30 comatproto "github.com/bluesky-social/indigo/api/atproto" 31 lexutil "github.com/bluesky-social/indigo/lex/util" 32 "github.com/go-chi/chi/v5" 33 "github.com/google/uuid" ··· 917 return 918 } 919 920 + forkAtUri := fork.RepoAt() 921 + forkAtUriStr := forkAtUri.String() 922 923 pullSource := &db.PullSource{ 924 Branch: sourceBranch, ··· 926 } 927 recordPullSource := &tangled.RepoPull_Source{ 928 Branch: sourceBranch, 929 + Repo: &forkAtUriStr, 930 Sha: sourceRev, 931 } 932
-1
appview/repo/repo.go
··· 1498 } 1499 log.Println("created repo record: ", atresp.Uri) 1500 1501 - repo.AtUri = atresp.Uri 1502 err = db.AddRepo(tx, repo) 1503 if err != nil { 1504 log.Println(err)
··· 1498 } 1499 log.Println("created repo record: ", atresp.Uri) 1500 1501 err = db.AddRepo(tx, repo) 1502 if err != nil { 1503 log.Println(err)
-1
appview/state/state.go
··· 400 // continue 401 } 402 403 - repo.AtUri = atresp.Uri 404 err = db.AddRepo(tx, repo) 405 if err != nil { 406 log.Println(err)
··· 400 // continue 401 } 402 403 err = db.AddRepo(tx, repo) 404 if err != nil { 405 log.Println(err)