mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-20 23:07:33 +00:00
770994e143
* fix: add avatar url in members, user grants, session and oidc responses * fix auth request tests
39 lines
813 B
Go
39 lines
813 B
Go
package view
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"github.com/jinzhu/gorm"
|
|
|
|
"github.com/caos/zitadel/internal/crypto"
|
|
"github.com/caos/zitadel/internal/id"
|
|
)
|
|
|
|
type View struct {
|
|
Db *gorm.DB
|
|
keyAlgorithm crypto.EncryptionAlgorithm
|
|
idGenerator id.Generator
|
|
prefixAvatarURL string
|
|
}
|
|
|
|
func StartView(sqlClient *sql.DB, keyAlgorithm crypto.EncryptionAlgorithm, idGenerator id.Generator, prefixAvatarURL string) (*View, error) {
|
|
gorm, err := gorm.Open("postgres", sqlClient)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &View{
|
|
Db: gorm,
|
|
keyAlgorithm: keyAlgorithm,
|
|
idGenerator: idGenerator,
|
|
prefixAvatarURL: prefixAvatarURL,
|
|
}, nil
|
|
}
|
|
|
|
func (v *View) Health() (err error) {
|
|
return v.Db.DB().Ping()
|
|
}
|
|
|
|
func (v *View) PrefixAvatarURL() string {
|
|
return v.prefixAvatarURL
|
|
}
|