fix whois gitignore
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Elizabeth Hunt 2025-01-05 16:55:49 -08:00
parent d25ec27fb1
commit 66df8b0e86
Signed by: simponic
GPG Key ID: 2909B9A7FF6213EE
2 changed files with 30 additions and 1 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.env
whois
*whois
!*whois/
*.db

28
api/whois/whois.go Normal file
View File

@ -0,0 +1,28 @@
package whois
import (
"log"
"net/http"
"git.simponic.xyz/simponic/whois/api/types"
"git.simponic.xyz/simponic/whois/database"
)
func FetchLatestName(context *types.RequestContext, req *http.Request, resp http.ResponseWriter) types.ContinuationChain {
return func(success types.Continuation, failure types.Continuation) types.ContinuationChain {
updates, err := database.ListUpdates(context.DBConn, database.ListUpdatesQuery{Limit: 1})
if err != nil {
log.Printf("err fetching updates %s", err)
resp.WriteHeader(http.StatusInternalServerError)
return failure(context, req, resp)
}
if len(updates) == 0 {
log.Printf("no updates yet")
resp.WriteHeader(http.StatusNotFound)
return failure(context, req, resp)
}
(*context.TemplateData)["Latest"] = updates[0]
return success(context, req, resp)
}
}