This commit is contained in:
parent
08f6de0bd7
commit
5e93ecee73
12 changed files with 241 additions and 109 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue