mirror of
https://github.com/thomiceli/opengist.git
synced 2025-06-23 18:27:57 +02:00
Search gists on user profile with title, visibility, language & topics (#422)
This commit is contained in:
@ -23,6 +23,7 @@ const (
|
||||
SyncGistPreviews
|
||||
ResetHooks
|
||||
IndexGists
|
||||
SyncGistLanguages
|
||||
)
|
||||
|
||||
var (
|
||||
@ -73,6 +74,8 @@ func Run(actionType int) {
|
||||
functionToRun = resetHooks
|
||||
case IndexGists:
|
||||
functionToRun = indexGists
|
||||
case SyncGistLanguages:
|
||||
functionToRun = syncGistLanguages
|
||||
default:
|
||||
log.Error().Msg("Unknown action type")
|
||||
}
|
||||
@ -166,3 +169,17 @@ func indexGists() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func syncGistLanguages() {
|
||||
log.Info().Msg("Syncing all Gist languages...")
|
||||
gists, err := db.GetAllGistsRows()
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("Cannot get gists")
|
||||
return
|
||||
}
|
||||
|
||||
for _, gist := range gists {
|
||||
log.Info().Msgf("Syncing languages for gist %d", gist.ID)
|
||||
gist.UpdateLanguages()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user