mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-25 11:33:11 +00:00
[F3] Forgejo driver and CLI
user, topic, project, label, milestone, repository, pull_request, release, asset, comment, reaction, review providers Signed-off-by: Earl Warren <contact@earl-warren.org> Preserve file size when creating attachments Introduced inc6f5029708repoList.LoadAttributes has a ctx argument now Rename `repo.GetOwner` to `repo.LoadOwner`bd66fa586aupgrade to the latest gof3 (cherry picked from commitc770713656) [F3] ID remapping logic is in place, remove workaround (cherry picked from commitd0fee30167) [F3] it is experimental, do not enable by default (cherry picked from commitde325b21d0) (cherry picked from commit547e7b3c40) (cherry picked from commit820df3a56b) (cherry picked from commiteaba87689b) (cherry picked from commit1b86896b3b) (cherry picked from commit0046aac1c6) (cherry picked from commitf14220df8f) (cherry picked from commit559b731001) (cherry picked from commit801f7d600d)
This commit is contained in:
parent
6323c6d1a2
commit
6aa76e9bcf
28 changed files with 2748 additions and 6 deletions
|
|
@ -230,6 +230,21 @@ func GetRepoTopicByName(ctx context.Context, repoID int64, topicName string) (*T
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// GetRepoTopicByID retrieves topic from ID for a repo if it exist
|
||||
func GetRepoTopicByID(ctx context.Context, repoID, topicID int64) (*Topic, error) {
|
||||
cond := builder.NewCond()
|
||||
var topic Topic
|
||||
cond = cond.And(builder.Eq{"repo_topic.repo_id": repoID}).And(builder.Eq{"topic.id": topicID})
|
||||
sess := db.GetEngine(ctx).Table("topic").Where(cond)
|
||||
sess.Join("INNER", "repo_topic", "repo_topic.topic_id = topic.id")
|
||||
if has, err := sess.Select("topic.*").Get(&topic); err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, ErrTopicNotExist{""}
|
||||
}
|
||||
return &topic, nil
|
||||
}
|
||||
|
||||
// AddTopic adds a topic name to a repository (if it does not already have it)
|
||||
func AddTopic(repoID int64, topicName string) (*Topic, error) {
|
||||
ctx, committer, err := db.TxContext(db.DefaultContext)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue