mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:17:32 +00:00
feat: store assets in database (#3290)
* feat: use database as asset storage * being only uploading assets if allowed * tests * fixes * cleanup after merge * renaming * various fixes * fix: change to repository event types and removed unused code * feat: set default features * error handling * error handling and naming * fix tests * fix tests * fix merge * rename
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"golang.org/x/text/language"
|
||||
@@ -11,7 +9,6 @@ import (
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
iam_model "github.com/caos/zitadel/internal/iam/model"
|
||||
"github.com/caos/zitadel/internal/static"
|
||||
)
|
||||
|
||||
type UserView struct {
|
||||
@@ -41,7 +38,6 @@ type HumanView struct {
|
||||
DisplayName string
|
||||
AvatarKey string
|
||||
AvatarURL string
|
||||
PreSignedAvatar *url.URL
|
||||
PreferredLanguage string
|
||||
Gender Gender
|
||||
Email string
|
||||
@@ -257,23 +253,6 @@ func (u *UserView) GetProfile() (*Profile, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (u *UserView) FillUserAvatar(ctx context.Context, static static.Storage, expiration time.Duration) error {
|
||||
if u.HumanView == nil {
|
||||
return errors.ThrowPreconditionFailed(nil, "MODEL-2k8da", "Errors.User.NotHuman")
|
||||
}
|
||||
if static != nil {
|
||||
if ctx == nil {
|
||||
ctx = context.Background()
|
||||
}
|
||||
presignesAvatarURL, err := static.GetObjectPresignedURL(ctx, u.ResourceOwner, u.AvatarKey, expiration)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
u.PreSignedAvatar = presignesAvatarURL
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *UserView) GetPhone() (*Phone, error) {
|
||||
if u.HumanView == nil {
|
||||
return nil, errors.ThrowPreconditionFailed(nil, "MODEL-him4a", "Errors.User.NotHuman")
|
||||
|
Reference in New Issue
Block a user