aboutsummaryrefslogtreecommitdiff
path: root/pkg/database/sql/user.go
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-04 18:38:10 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-04 18:40:02 +0200
commit311ab744fe1bf278b18c25892497271988399e9a (patch)
tree89f956f521000ac0d22f815e91cab4cf00a8b70f /pkg/database/sql/user.go
parentc2d666b43477ea7042b574ad940c508216cb0e83 (diff)
downloadlens-311ab744fe1bf278b18c25892497271988399e9a.tar.gz
lens-311ab744fe1bf278b18c25892497271988399e9a.tar.bz2
lens-311ab744fe1bf278b18c25892497271988399e9a.zip
feat: Add user based files
Now files follow user path configuration
Diffstat (limited to 'pkg/database/sql/user.go')
-rw-r--r--pkg/database/sql/user.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/pkg/database/sql/user.go b/pkg/database/sql/user.go
index 479a9c5..11718be 100644
--- a/pkg/database/sql/user.go
+++ b/pkg/database/sql/user.go
@@ -201,3 +201,20 @@ func (u *UserRepository) Any(ctx context.Context) (bool, error) {
return exists, nil
}
+
+func (u *UserRepository) GetPathFromUserID(ctx context.Context, id uint) (string, error) {
+ var userPath string
+
+ result := u.db.
+ WithContext(ctx).
+ Model(&User{}).
+ Select("path").
+ Where("id = ?", id).
+ First(&userPath)
+
+ if result.Error != nil {
+ return "", result.Error
+ }
+
+ return userPath, nil
+}