blob: 1118a099e665efbc00258a1db582d7433704b910 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package sparkles
import (
"net/http"
"github.com/xlgmokha/x/pkg/log"
"github.com/xlgmokha/x/pkg/mapper"
"github.com/xlgmokha/x/pkg/serde"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/domain"
)
func init() {
mapper.Register[*http.Request, *domain.Sparkle](func(r *http.Request) *domain.Sparkle {
sparkle, err := serde.FromHTTP[*domain.Sparkle](r)
if err != nil {
log.WithFields(r.Context(), log.Fields{"error": err})
}
sparkle.Author = cfg.CurrentUser.From(r.Context())
return sparkle
})
}
|