|
|
@@ -324,3 +324,16 @@ func SaveTopics(repoID int64, topicNames ...string) error { |
|
|
|
|
|
|
|
return sess.Commit() |
|
|
|
} |
|
|
|
|
|
|
|
func GetOrgTopics(orgId int64) ([]Topic, error) { |
|
|
|
result := make([]Topic, 0) |
|
|
|
sql := "select t.* from repository r " + |
|
|
|
"inner join repo_topic rt on rt.repo_id = r.id " + |
|
|
|
"inner join topic t on rt.topic_id = t.id " + |
|
|
|
"where r.owner_id = ? order by repo_count desc" |
|
|
|
if e := x.SQL(sql, orgId).Find(&result); e != nil { |
|
|
|
return nil, e |
|
|
|
} |
|
|
|
|
|
|
|
return result, nil |
|
|
|
} |