User import now works
Some checks failed
/ docker (push) Failing after 3m56s

This commit is contained in:
Melody Becker 2025-04-15 17:18:56 +02:00
parent 08f6de0bd7
commit 5e93ecee73
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
12 changed files with 241 additions and 109 deletions

View file

@ -8,7 +8,6 @@ import (
"time"
webutils "git.mstar.dev/mstar/goutils/http"
"git.mstar.dev/mstar/goutils/other"
"git.mstar.dev/mstar/goutils/sliceutils"
"github.com/rs/zerolog/hlog"
@ -119,7 +118,7 @@ func users(w http.ResponseWriter, r *http.Request) {
}
}
if sliceutils.ContainsFunc(user.BeingTypes, func(t models.UserToBeing) bool {
return t.Being == models.BEING_CAT
return t.Being == string(models.BEING_CAT)
}) {
data.IsCat = true
// data.SpeakAsCat = true // TODO: Move to check of separate field in db model
@ -128,10 +127,16 @@ func users(w http.ResponseWriter, r *http.Request) {
data.Location = &user.Location.String
}
if user.Birthday.Valid {
data.Birthday = other.IntoPointer(user.Birthday.Time.Format("2006-Jan-02")) //YYYY-Month-DD
data.Birthday = &user.Birthday.String
// data.Birthday = other.IntoPointer(user.Birthday.Time.Format("2006-Jan-02")) //YYYY-Month-DD
}
encoded, err := json.Marshal(data)
if err != nil {
log.Error().Err(err).Msg("Failed to marshal response")
webutils.ProblemDetailsStatusOnly(w, http.StatusInternalServerError)
return
}
w.Header().Add("Content-Type", "application/activity+json")
fmt.Fprint(w, string(encoded))
}