feat: file uploads
This commit is contained in:
@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
func Migrate(db *gorm.DB) error {
|
||||
err := db.AutoMigrate(&models.User{}, &models.Item{})
|
||||
err := db.AutoMigrate(&models.User{}, &models.Item{}, &models.File{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ type AuthHandler struct {
|
||||
key []byte
|
||||
}
|
||||
|
||||
func (s *AuthHandler) Login(ctx context.Context, req *connect.Request[userv1.LoginRequest]) (*connect.Response[userv1.LoginResponse], error) {
|
||||
func (h *AuthHandler) Login(ctx context.Context, req *connect.Request[userv1.LoginRequest]) (*connect.Response[userv1.LoginResponse], error) {
|
||||
// Validate
|
||||
user := models.User{}
|
||||
if err := s.db.First(&user, "username = ?", req.Msg.Username).Error; err != nil {
|
||||
if err := h.db.First(&user, "username = ?", req.Msg.Username).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, connect.NewError(connect.CodePermissionDenied, errors.New("invalid username or password"))
|
||||
}
|
||||
@ -46,7 +46,7 @@ func (s *AuthHandler) Login(ctx context.Context, req *connect.Request[userv1.Log
|
||||
Time: time.Now().Add(time.Hour * 24),
|
||||
},
|
||||
})
|
||||
ss, err := t.SignedString(s.key)
|
||||
ss, err := t.SignedString(h.key)
|
||||
if err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
@ -69,9 +69,9 @@ func (s *AuthHandler) Login(ctx context.Context, req *connect.Request[userv1.Log
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (s *AuthHandler) SignUp(ctx context.Context, req *connect.Request[userv1.SignUpRequest]) (*connect.Response[userv1.SignUpResponse], error) {
|
||||
func (h *AuthHandler) SignUp(ctx context.Context, req *connect.Request[userv1.SignUpRequest]) (*connect.Response[userv1.SignUpResponse], error) {
|
||||
// Validate
|
||||
if err := s.db.First(&models.User{}, "username = ?", req.Msg.Username).Error; err != nil {
|
||||
if err := h.db.First(&models.User{}, "username = ?", req.Msg.Username).Error; err != nil {
|
||||
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
@ -93,7 +93,7 @@ func (s *AuthHandler) SignUp(ctx context.Context, req *connect.Request[userv1.Si
|
||||
Username: req.Msg.Username,
|
||||
Password: string(hash),
|
||||
}
|
||||
if err := s.db.Create(&user).Error; err != nil {
|
||||
if err := h.db.Create(&user).Error; err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ func (s *AuthHandler) SignUp(ctx context.Context, req *connect.Request[userv1.Si
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (s *AuthHandler) Logout(ctx context.Context, req *connect.Request[userv1.LogoutRequest]) (*connect.Response[userv1.LogoutResponse], error) {
|
||||
func (h *AuthHandler) Logout(ctx context.Context, req *connect.Request[userv1.LogoutRequest]) (*connect.Response[userv1.LogoutResponse], error) {
|
||||
// Clear cookie
|
||||
cookie := http.Cookie{
|
||||
Name: "token",
|
||||
|
19
server/internal/handlers/client.go
Normal file
19
server/internal/handlers/client.go
Normal file
@ -0,0 +1,19 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/spotdemo4/trevstack/server/internal/interceptors"
|
||||
)
|
||||
|
||||
func NewClientHandler(client embed.FS, key string) http.Handler {
|
||||
clientFs, err := fs.Sub(client, "client")
|
||||
if err != nil {
|
||||
log.Fatalf("failed to get sub filesystem: %v", err)
|
||||
}
|
||||
|
||||
return interceptors.WithAuthRedirect(http.FileServer(http.FS(clientFs)), key)
|
||||
}
|
66
server/internal/handlers/file.go
Normal file
66
server/internal/handlers/file.go
Normal file
@ -0,0 +1,66 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/spotdemo4/trevstack/server/internal/interceptors"
|
||||
"github.com/spotdemo4/trevstack/server/internal/models"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type FileHandler struct {
|
||||
db *gorm.DB
|
||||
key []byte
|
||||
}
|
||||
|
||||
func (h *FileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
userid, ok := interceptors.GetUserContext(r.Context())
|
||||
if !ok {
|
||||
http.Redirect(w, r, "/auth", http.StatusFound)
|
||||
return
|
||||
}
|
||||
|
||||
// Get the file id from the path
|
||||
pathItems := strings.Split(r.URL.Path, "/")
|
||||
if len(pathItems) < 3 {
|
||||
http.Redirect(w, r, "/auth", http.StatusFound)
|
||||
return
|
||||
}
|
||||
id := pathItems[2]
|
||||
|
||||
// Get the file from the database
|
||||
file := models.File{}
|
||||
if err := h.db.First(&file, "id = ? AND user_id = ?", id, userid).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
http.Error(w, "File not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
log.Println(err)
|
||||
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
// Serve the file
|
||||
if r.Method == http.MethodGet {
|
||||
w.Header().Set("Content-Type", http.DetectContentType(file.Data))
|
||||
w.Write(file.Data)
|
||||
return
|
||||
} else {
|
||||
http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func NewFileHandler(db *gorm.DB, key string) http.Handler {
|
||||
return interceptors.WithAuthRedirect(
|
||||
&FileHandler{
|
||||
db: db,
|
||||
key: []byte(key),
|
||||
},
|
||||
key,
|
||||
)
|
||||
}
|
@ -21,7 +21,7 @@ type ItemHandler struct {
|
||||
}
|
||||
|
||||
func (h *ItemHandler) GetItem(ctx context.Context, req *connect.Request[itemv1.GetItemRequest]) (*connect.Response[itemv1.GetItemResponse], error) {
|
||||
userid, ok := interceptors.UserFromContext(ctx)
|
||||
userid, ok := interceptors.GetUserContext(ctx)
|
||||
if !ok {
|
||||
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("unauthenticated"))
|
||||
}
|
||||
@ -39,7 +39,7 @@ func (h *ItemHandler) GetItem(ctx context.Context, req *connect.Request[itemv1.G
|
||||
}
|
||||
|
||||
func (h *ItemHandler) GetItems(ctx context.Context, req *connect.Request[itemv1.GetItemsRequest]) (*connect.Response[itemv1.GetItemsResponse], error) {
|
||||
userid, ok := interceptors.UserFromContext(ctx)
|
||||
userid, ok := interceptors.GetUserContext(ctx)
|
||||
if !ok {
|
||||
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("unauthenticated"))
|
||||
}
|
||||
@ -89,7 +89,7 @@ func (h *ItemHandler) GetItems(ctx context.Context, req *connect.Request[itemv1.
|
||||
}
|
||||
|
||||
func (h *ItemHandler) CreateItem(ctx context.Context, req *connect.Request[itemv1.CreateItemRequest]) (*connect.Response[itemv1.CreateItemResponse], error) {
|
||||
userid, ok := interceptors.UserFromContext(ctx)
|
||||
userid, ok := interceptors.GetUserContext(ctx)
|
||||
if !ok {
|
||||
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("unauthenticated"))
|
||||
}
|
||||
@ -114,7 +114,7 @@ func (h *ItemHandler) CreateItem(ctx context.Context, req *connect.Request[itemv
|
||||
}
|
||||
|
||||
func (h *ItemHandler) UpdateItem(ctx context.Context, req *connect.Request[itemv1.UpdateItemRequest]) (*connect.Response[itemv1.UpdateItemResponse], error) {
|
||||
userid, ok := interceptors.UserFromContext(ctx)
|
||||
userid, ok := interceptors.GetUserContext(ctx)
|
||||
if !ok {
|
||||
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("unauthenticated"))
|
||||
}
|
||||
@ -144,7 +144,7 @@ func (h *ItemHandler) UpdateItem(ctx context.Context, req *connect.Request[itemv
|
||||
}
|
||||
|
||||
func (h *ItemHandler) DeleteItem(ctx context.Context, req *connect.Request[itemv1.DeleteItemRequest]) (*connect.Response[itemv1.DeleteItemResponse], error) {
|
||||
userid, ok := interceptors.UserFromContext(ctx)
|
||||
userid, ok := interceptors.GetUserContext(ctx)
|
||||
if !ok {
|
||||
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("unauthenticated"))
|
||||
}
|
||||
|
@ -22,15 +22,33 @@ type UserHandler struct {
|
||||
key []byte
|
||||
}
|
||||
|
||||
func (s *UserHandler) ChangePassword(ctx context.Context, req *connect.Request[userv1.ChangePasswordRequest]) (*connect.Response[userv1.ChangePasswordResponse], error) {
|
||||
userid, ok := interceptors.UserFromContext(ctx)
|
||||
func (h *UserHandler) GetUser(ctx context.Context, req *connect.Request[userv1.GetUserRequest]) (*connect.Response[userv1.GetUserResponse], error) {
|
||||
userid, ok := interceptors.GetUserContext(ctx)
|
||||
if !ok {
|
||||
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("unauthenticated"))
|
||||
}
|
||||
|
||||
// Get user
|
||||
user := models.User{}
|
||||
if err := s.db.First(&user, "id = ?", userid).Error; err != nil {
|
||||
if err := h.db.Preload("ProfilePicture").First(&user, "id = ?", userid).Error; err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
|
||||
res := connect.NewResponse(&userv1.GetUserResponse{
|
||||
User: user.ToConnectV1(),
|
||||
})
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (h *UserHandler) UpdatePassword(ctx context.Context, req *connect.Request[userv1.UpdatePasswordRequest]) (*connect.Response[userv1.UpdatePasswordResponse], error) {
|
||||
userid, ok := interceptors.GetUserContext(ctx)
|
||||
if !ok {
|
||||
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("unauthenticated"))
|
||||
}
|
||||
|
||||
// Get user
|
||||
user := models.User{}
|
||||
if err := h.db.First(&user, "id = ?", userid).Error; err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
|
||||
@ -49,23 +67,23 @@ func (s *UserHandler) ChangePassword(ctx context.Context, req *connect.Request[u
|
||||
}
|
||||
|
||||
// Update password
|
||||
if err := s.db.Model(&user).Update("password", string(hash)).Error; err != nil {
|
||||
if err := h.db.Model(&user).Update("password", string(hash)).Error; err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
|
||||
res := connect.NewResponse(&userv1.ChangePasswordResponse{})
|
||||
res := connect.NewResponse(&userv1.UpdatePasswordResponse{})
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (s *UserHandler) APIKey(ctx context.Context, req *connect.Request[userv1.APIKeyRequest]) (*connect.Response[userv1.APIKeyResponse], error) {
|
||||
userid, ok := interceptors.UserFromContext(ctx)
|
||||
func (h *UserHandler) GetAPIKey(ctx context.Context, req *connect.Request[userv1.GetAPIKeyRequest]) (*connect.Response[userv1.GetAPIKeyResponse], error) {
|
||||
userid, ok := interceptors.GetUserContext(ctx)
|
||||
if !ok {
|
||||
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("unauthenticated"))
|
||||
}
|
||||
|
||||
// Get user
|
||||
user := models.User{}
|
||||
if err := s.db.First(&user, "id = ?", userid).Error; err != nil {
|
||||
if err := h.db.First(&user, "id = ?", userid).Error; err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
|
||||
@ -85,17 +103,71 @@ func (s *UserHandler) APIKey(ctx context.Context, req *connect.Request[userv1.AP
|
||||
Time: time.Now(),
|
||||
},
|
||||
})
|
||||
ss, err := t.SignedString(s.key)
|
||||
ss, err := t.SignedString(h.key)
|
||||
if err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
|
||||
res := connect.NewResponse(&userv1.APIKeyResponse{
|
||||
res := connect.NewResponse(&userv1.GetAPIKeyResponse{
|
||||
Key: ss,
|
||||
})
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (h *UserHandler) UpdateProfilePicture(ctx context.Context, req *connect.Request[userv1.UpdateProfilePictureRequest]) (*connect.Response[userv1.UpdateProfilePictureResponse], error) {
|
||||
userid, ok := interceptors.GetUserContext(ctx)
|
||||
if !ok {
|
||||
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("unauthenticated"))
|
||||
}
|
||||
|
||||
// Validate file
|
||||
fileType := http.DetectContentType(req.Msg.Data)
|
||||
if fileType != "image/jpeg" && fileType != "image/png" {
|
||||
return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("invalid file type"))
|
||||
}
|
||||
|
||||
// Save bytes into file
|
||||
file := models.File{
|
||||
Name: req.Msg.FileName,
|
||||
Data: req.Msg.Data,
|
||||
UserID: uint(userid),
|
||||
}
|
||||
if err := h.db.Create(&file).Error; err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
|
||||
// Get user info
|
||||
user := models.User{}
|
||||
if err := h.db.First(&user, "id = ?", userid).Error; err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
|
||||
// Get old profile picture ID
|
||||
var ppid *uint32
|
||||
if user.ProfilePicture != nil {
|
||||
ppid = &user.ProfilePicture.ID
|
||||
}
|
||||
|
||||
// Update user profile picture
|
||||
fid := uint(file.ID)
|
||||
user.ProfilePictureID = &fid
|
||||
if err := h.db.Save(&user).Error; err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
|
||||
// Delete old profile picture if exists
|
||||
if ppid != nil {
|
||||
if err := h.db.Delete(models.File{}, "id = ?", *ppid).Error; err != nil {
|
||||
return nil, connect.NewError(connect.CodeInternal, err)
|
||||
}
|
||||
}
|
||||
|
||||
res := connect.NewResponse(&userv1.UpdateProfilePictureResponse{
|
||||
User: user.ToConnectV1(),
|
||||
})
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func NewUserHandler(db *gorm.DB, key string) (string, http.Handler) {
|
||||
interceptors := connect.WithInterceptors(interceptors.NewAuthInterceptor(key))
|
||||
|
||||
|
@ -15,7 +15,6 @@ import (
|
||||
|
||||
func WithAuthRedirect(next http.Handler, key string) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
log.Println("start", "method", r.Method, "path", r.URL.Path)
|
||||
pathItems := strings.Split(r.URL.Path, "/")
|
||||
|
||||
if len(pathItems) < 2 {
|
||||
@ -38,10 +37,14 @@ func WithAuthRedirect(next http.Handler, key string) http.Handler {
|
||||
cookies := getCookies(r.Header.Get("Cookie"))
|
||||
for _, cookie := range cookies {
|
||||
if cookie.Name == "token" {
|
||||
_, err := validateToken(cookie.Value, key)
|
||||
subject, err := validateToken(cookie.Value, key)
|
||||
if err == nil {
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
ctx, err := newUserContext(r.Context(), subject)
|
||||
if err == nil {
|
||||
r = r.WithContext(ctx)
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,7 +83,7 @@ func (i *authInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc {
|
||||
if cookie.Name == "token" {
|
||||
subject, err := validateToken(cookie.Value, i.key)
|
||||
if err == nil {
|
||||
ctx, err = i.newContext(ctx, subject)
|
||||
ctx, err = newUserContext(ctx, subject)
|
||||
if err == nil {
|
||||
return next(ctx, req)
|
||||
}
|
||||
@ -93,7 +96,7 @@ func (i *authInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc {
|
||||
if authorization != "" && len(authorization) > 7 {
|
||||
subject, err := validateToken(authorization[7:], i.key)
|
||||
if err == nil {
|
||||
ctx, err = i.newContext(ctx, subject)
|
||||
ctx, err = newUserContext(ctx, subject)
|
||||
if err == nil {
|
||||
return next(ctx, req)
|
||||
}
|
||||
@ -127,7 +130,7 @@ func (i *authInterceptor) WrapStreamingHandler(next connect.StreamingHandlerFunc
|
||||
if cookie.Name == "token" {
|
||||
subject, err := validateToken(cookie.Value, i.key)
|
||||
if err == nil {
|
||||
ctx, err = i.newContext(ctx, subject)
|
||||
ctx, err = newUserContext(ctx, subject)
|
||||
if err == nil {
|
||||
return next(ctx, conn)
|
||||
}
|
||||
@ -140,7 +143,7 @@ func (i *authInterceptor) WrapStreamingHandler(next connect.StreamingHandlerFunc
|
||||
if authorization != "" && len(authorization) > 7 {
|
||||
subject, err := validateToken(authorization[7:], i.key)
|
||||
if err == nil {
|
||||
ctx, err = i.newContext(ctx, subject)
|
||||
ctx, err = newUserContext(ctx, subject)
|
||||
if err == nil {
|
||||
return next(ctx, conn)
|
||||
}
|
||||
@ -211,8 +214,8 @@ type key int
|
||||
// instead of using this key directly.
|
||||
var userKey key
|
||||
|
||||
// NewContext returns a new Context that carries value u.
|
||||
func (i *authInterceptor) newContext(ctx context.Context, subject string) (context.Context, error) {
|
||||
// newUserContext returns a new Context that carries value u.
|
||||
func newUserContext(ctx context.Context, subject string) (context.Context, error) {
|
||||
id, err := strconv.Atoi(subject)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -221,8 +224,8 @@ func (i *authInterceptor) newContext(ctx context.Context, subject string) (conte
|
||||
return context.WithValue(ctx, userKey, id), nil
|
||||
}
|
||||
|
||||
// FromContext returns the User value stored in ctx, if any.
|
||||
func UserFromContext(ctx context.Context) (int, bool) {
|
||||
// getUserContext returns the User value stored in ctx, if any.
|
||||
func GetUserContext(ctx context.Context) (int, bool) {
|
||||
u, ok := ctx.Value(userKey).(int)
|
||||
return u, ok
|
||||
}
|
||||
|
12
server/internal/models/file.go
Normal file
12
server/internal/models/file.go
Normal file
@ -0,0 +1,12 @@
|
||||
package models
|
||||
|
||||
type File struct {
|
||||
ID uint32 `gorm:"primaryKey"`
|
||||
|
||||
Name string
|
||||
Data []byte
|
||||
|
||||
// User
|
||||
UserID uint
|
||||
User User
|
||||
}
|
@ -1,8 +1,32 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
userv1 "github.com/spotdemo4/trevstack/server/internal/services/user/v1"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID uint32 `gorm:"primaryKey"`
|
||||
|
||||
Username string
|
||||
Password string
|
||||
|
||||
// Profile picture
|
||||
ProfilePictureID *uint
|
||||
ProfilePicture *File
|
||||
}
|
||||
|
||||
func (u User) ToConnectV1() *userv1.User {
|
||||
var ppid *string
|
||||
if u.ProfilePicture != nil {
|
||||
id := fmt.Sprintf("/file/%d", u.ProfilePicture.ID)
|
||||
ppid = &id
|
||||
}
|
||||
|
||||
return &userv1.User{
|
||||
Id: u.ID,
|
||||
Username: u.Username,
|
||||
ProfilePicture: ppid,
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,147 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type ChangePasswordRequest struct {
|
||||
type User struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
|
||||
ProfilePicture *string `protobuf:"bytes,3,opt,name=profile_picture,json=profilePicture,proto3,oneof" json:"profile_picture,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *User) Reset() {
|
||||
*x = User{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *User) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*User) ProtoMessage() {}
|
||||
|
||||
func (x *User) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use User.ProtoReflect.Descriptor instead.
|
||||
func (*User) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *User) GetId() uint32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *User) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *User) GetProfilePicture() string {
|
||||
if x != nil && x.ProfilePicture != nil {
|
||||
return *x.ProfilePicture
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetUserRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetUserRequest) Reset() {
|
||||
*x = GetUserRequest{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetUserRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetUserRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserRequest) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
type GetUserResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetUserResponse) Reset() {
|
||||
*x = GetUserResponse{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetUserResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetUserResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserResponse) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *GetUserResponse) GetUser() *User {
|
||||
if x != nil {
|
||||
return x.User
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdatePasswordRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
OldPassword string `protobuf:"bytes,1,opt,name=old_password,json=oldPassword,proto3" json:"old_password,omitempty"`
|
||||
NewPassword string `protobuf:"bytes,2,opt,name=new_password,json=newPassword,proto3" json:"new_password,omitempty"`
|
||||
@ -30,21 +170,21 @@ type ChangePasswordRequest struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ChangePasswordRequest) Reset() {
|
||||
*x = ChangePasswordRequest{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[0]
|
||||
func (x *UpdatePasswordRequest) Reset() {
|
||||
*x = UpdatePasswordRequest{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ChangePasswordRequest) String() string {
|
||||
func (x *UpdatePasswordRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ChangePasswordRequest) ProtoMessage() {}
|
||||
func (*UpdatePasswordRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ChangePasswordRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[0]
|
||||
func (x *UpdatePasswordRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -55,53 +195,54 @@ func (x *ChangePasswordRequest) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ChangePasswordRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ChangePasswordRequest) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{0}
|
||||
// Deprecated: Use UpdatePasswordRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UpdatePasswordRequest) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ChangePasswordRequest) GetOldPassword() string {
|
||||
func (x *UpdatePasswordRequest) GetOldPassword() string {
|
||||
if x != nil {
|
||||
return x.OldPassword
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ChangePasswordRequest) GetNewPassword() string {
|
||||
func (x *UpdatePasswordRequest) GetNewPassword() string {
|
||||
if x != nil {
|
||||
return x.NewPassword
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ChangePasswordRequest) GetConfirmPassword() string {
|
||||
func (x *UpdatePasswordRequest) GetConfirmPassword() string {
|
||||
if x != nil {
|
||||
return x.ConfirmPassword
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ChangePasswordResponse struct {
|
||||
type UpdatePasswordResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ChangePasswordResponse) Reset() {
|
||||
*x = ChangePasswordResponse{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[1]
|
||||
func (x *UpdatePasswordResponse) Reset() {
|
||||
*x = UpdatePasswordResponse{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ChangePasswordResponse) String() string {
|
||||
func (x *UpdatePasswordResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ChangePasswordResponse) ProtoMessage() {}
|
||||
func (*UpdatePasswordResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ChangePasswordResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[1]
|
||||
func (x *UpdatePasswordResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -112,12 +253,19 @@ func (x *ChangePasswordResponse) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ChangePasswordResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ChangePasswordResponse) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{1}
|
||||
// Deprecated: Use UpdatePasswordResponse.ProtoReflect.Descriptor instead.
|
||||
func (*UpdatePasswordResponse) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
type APIKeyRequest struct {
|
||||
func (x *UpdatePasswordResponse) GetUser() *User {
|
||||
if x != nil {
|
||||
return x.User
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetAPIKeyRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty"`
|
||||
ConfirmPassword string `protobuf:"bytes,2,opt,name=confirm_password,json=confirmPassword,proto3" json:"confirm_password,omitempty"`
|
||||
@ -125,21 +273,21 @@ type APIKeyRequest struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *APIKeyRequest) Reset() {
|
||||
*x = APIKeyRequest{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[2]
|
||||
func (x *GetAPIKeyRequest) Reset() {
|
||||
*x = GetAPIKeyRequest{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *APIKeyRequest) String() string {
|
||||
func (x *GetAPIKeyRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*APIKeyRequest) ProtoMessage() {}
|
||||
func (*GetAPIKeyRequest) ProtoMessage() {}
|
||||
|
||||
func (x *APIKeyRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[2]
|
||||
func (x *GetAPIKeyRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -150,47 +298,47 @@ func (x *APIKeyRequest) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use APIKeyRequest.ProtoReflect.Descriptor instead.
|
||||
func (*APIKeyRequest) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{2}
|
||||
// Deprecated: Use GetAPIKeyRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetAPIKeyRequest) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *APIKeyRequest) GetPassword() string {
|
||||
func (x *GetAPIKeyRequest) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *APIKeyRequest) GetConfirmPassword() string {
|
||||
func (x *GetAPIKeyRequest) GetConfirmPassword() string {
|
||||
if x != nil {
|
||||
return x.ConfirmPassword
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type APIKeyResponse struct {
|
||||
type GetAPIKeyResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *APIKeyResponse) Reset() {
|
||||
*x = APIKeyResponse{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[3]
|
||||
func (x *GetAPIKeyResponse) Reset() {
|
||||
*x = GetAPIKeyResponse{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *APIKeyResponse) String() string {
|
||||
func (x *GetAPIKeyResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*APIKeyResponse) ProtoMessage() {}
|
||||
func (*GetAPIKeyResponse) ProtoMessage() {}
|
||||
|
||||
func (x *APIKeyResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[3]
|
||||
func (x *GetAPIKeyResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -201,62 +349,193 @@ func (x *APIKeyResponse) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use APIKeyResponse.ProtoReflect.Descriptor instead.
|
||||
func (*APIKeyResponse) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{3}
|
||||
// Deprecated: Use GetAPIKeyResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetAPIKeyResponse) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *APIKeyResponse) GetKey() string {
|
||||
func (x *GetAPIKeyResponse) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UpdateProfilePictureRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`
|
||||
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UpdateProfilePictureRequest) Reset() {
|
||||
*x = UpdateProfilePictureRequest{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UpdateProfilePictureRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateProfilePictureRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateProfilePictureRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateProfilePictureRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateProfilePictureRequest) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *UpdateProfilePictureRequest) GetFileName() string {
|
||||
if x != nil {
|
||||
return x.FileName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UpdateProfilePictureRequest) GetData() []byte {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateProfilePictureResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UpdateProfilePictureResponse) Reset() {
|
||||
*x = UpdateProfilePictureResponse{}
|
||||
mi := &file_user_v1_user_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UpdateProfilePictureResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateProfilePictureResponse) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateProfilePictureResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_v1_user_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateProfilePictureResponse.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateProfilePictureResponse) Descriptor() ([]byte, []int) {
|
||||
return file_user_v1_user_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *UpdateProfilePictureResponse) GetUser() *User {
|
||||
if x != nil {
|
||||
return x.User
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_user_v1_user_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_user_v1_user_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x12, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x22, 0x88, 0x01,
|
||||
0x0a, 0x15, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x6c, 0x64, 0x5f, 0x70,
|
||||
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f,
|
||||
0x6c, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x65,
|
||||
0x77, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0b, 0x6e, 0x65, 0x77, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x29, 0x0a,
|
||||
0x10, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,
|
||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d,
|
||||
0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x43, 0x68, 0x61, 0x6e,
|
||||
0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x56, 0x0a, 0x0d, 0x41, 0x50, 0x49, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12,
|
||||
0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69,
|
||||
0x72, 0x6d, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x22, 0x0a, 0x0e, 0x41, 0x50,
|
||||
0x49, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03,
|
||||
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x32, 0x9f,
|
||||
0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53,
|
||||
0x0a, 0x0e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x12, 0x1e, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67,
|
||||
0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x1f, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67,
|
||||
0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x41, 0x50, 0x49, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x2e,
|
||||
0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x50, 0x49, 0x4b, 0x65, 0x79, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x41, 0x50, 0x49, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
||||
0x42, 0x9d, 0x01, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31,
|
||||
0x42, 0x09, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67,
|
||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x70, 0x6f, 0x74, 0x64, 0x65,
|
||||
0x6d, 0x6f, 0x34, 0x2f, 0x74, 0x72, 0x65, 0x76, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x75,
|
||||
0x73, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x55, 0x58, 0x58, 0xaa, 0x02, 0x07, 0x55, 0x73,
|
||||
0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x07, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2,
|
||||
0x02, 0x13, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
|
||||
0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x08, 0x55, 0x73, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x22, 0x74, 0x0a,
|
||||
0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x12, 0x2c, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x69, 0x63,
|
||||
0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x70, 0x72,
|
||||
0x6f, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x88, 0x01, 0x01, 0x42,
|
||||
0x12, 0x0a, 0x10, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x69, 0x63, 0x74,
|
||||
0x75, 0x72, 0x65, 0x22, 0x10, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x34, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x88, 0x01, 0x0a, 0x15,
|
||||
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x73,
|
||||
0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x6c, 0x64,
|
||||
0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x65, 0x77, 0x5f,
|
||||
0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
|
||||
0x6e, 0x65, 0x77, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61,
|
||||
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x3b, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x21, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d,
|
||||
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75,
|
||||
0x73, 0x65, 0x72, 0x22, 0x59, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x41, 0x50, 0x49, 0x4b, 0x65, 0x79,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x5f, 0x70,
|
||||
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x25,
|
||||
0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x50, 0x49, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x4e, 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50,
|
||||
0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d,
|
||||
0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||
0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x41, 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50,
|
||||
0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,
|
||||
0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x32, 0xcf, 0x02, 0x0a, 0x0b, 0x55, 0x73, 0x65,
|
||||
0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55,
|
||||
0x73, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
|
||||
0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x75,
|
||||
0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x2e, 0x75, 0x73, 0x65,
|
||||
0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x75, 0x73, 0x65,
|
||||
0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x44, 0x0a,
|
||||
0x09, 0x47, 0x65, 0x74, 0x41, 0x50, 0x49, 0x4b, 0x65, 0x79, 0x12, 0x19, 0x2e, 0x75, 0x73, 0x65,
|
||||
0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x50, 0x49, 0x4b, 0x65, 0x79, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x41, 0x50, 0x49, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x00, 0x12, 0x65, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f,
|
||||
0x66, 0x69, 0x6c, 0x65, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x24, 0x2e, 0x75, 0x73,
|
||||
0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x66,
|
||||
0x69, 0x6c, 0x65, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x25, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x9d, 0x01, 0x0a, 0x0b, 0x63,
|
||||
0x6f, 0x6d, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x55, 0x73, 0x65, 0x72,
|
||||
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x70, 0x6f, 0x74, 0x64, 0x65, 0x6d, 0x6f, 0x34, 0x2f, 0x74, 0x72,
|
||||
0x65, 0x76, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x69,
|
||||
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,
|
||||
0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x76, 0x31, 0xa2,
|
||||
0x02, 0x03, 0x55, 0x58, 0x58, 0xaa, 0x02, 0x07, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca,
|
||||
0x02, 0x07, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x13, 0x55, 0x73, 0x65, 0x72,
|
||||
0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
|
||||
0x02, 0x08, 0x55, 0x73, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
})
|
||||
|
||||
var (
|
||||
@ -271,23 +550,35 @@ func file_user_v1_user_proto_rawDescGZIP() []byte {
|
||||
return file_user_v1_user_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_user_v1_user_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_user_v1_user_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_user_v1_user_proto_goTypes = []any{
|
||||
(*ChangePasswordRequest)(nil), // 0: user.v1.ChangePasswordRequest
|
||||
(*ChangePasswordResponse)(nil), // 1: user.v1.ChangePasswordResponse
|
||||
(*APIKeyRequest)(nil), // 2: user.v1.APIKeyRequest
|
||||
(*APIKeyResponse)(nil), // 3: user.v1.APIKeyResponse
|
||||
(*User)(nil), // 0: user.v1.User
|
||||
(*GetUserRequest)(nil), // 1: user.v1.GetUserRequest
|
||||
(*GetUserResponse)(nil), // 2: user.v1.GetUserResponse
|
||||
(*UpdatePasswordRequest)(nil), // 3: user.v1.UpdatePasswordRequest
|
||||
(*UpdatePasswordResponse)(nil), // 4: user.v1.UpdatePasswordResponse
|
||||
(*GetAPIKeyRequest)(nil), // 5: user.v1.GetAPIKeyRequest
|
||||
(*GetAPIKeyResponse)(nil), // 6: user.v1.GetAPIKeyResponse
|
||||
(*UpdateProfilePictureRequest)(nil), // 7: user.v1.UpdateProfilePictureRequest
|
||||
(*UpdateProfilePictureResponse)(nil), // 8: user.v1.UpdateProfilePictureResponse
|
||||
}
|
||||
var file_user_v1_user_proto_depIdxs = []int32{
|
||||
0, // 0: user.v1.UserService.ChangePassword:input_type -> user.v1.ChangePasswordRequest
|
||||
2, // 1: user.v1.UserService.APIKey:input_type -> user.v1.APIKeyRequest
|
||||
1, // 2: user.v1.UserService.ChangePassword:output_type -> user.v1.ChangePasswordResponse
|
||||
3, // 3: user.v1.UserService.APIKey:output_type -> user.v1.APIKeyResponse
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
0, // 0: user.v1.GetUserResponse.user:type_name -> user.v1.User
|
||||
0, // 1: user.v1.UpdatePasswordResponse.user:type_name -> user.v1.User
|
||||
0, // 2: user.v1.UpdateProfilePictureResponse.user:type_name -> user.v1.User
|
||||
1, // 3: user.v1.UserService.GetUser:input_type -> user.v1.GetUserRequest
|
||||
3, // 4: user.v1.UserService.UpdatePassword:input_type -> user.v1.UpdatePasswordRequest
|
||||
5, // 5: user.v1.UserService.GetAPIKey:input_type -> user.v1.GetAPIKeyRequest
|
||||
7, // 6: user.v1.UserService.UpdateProfilePicture:input_type -> user.v1.UpdateProfilePictureRequest
|
||||
2, // 7: user.v1.UserService.GetUser:output_type -> user.v1.GetUserResponse
|
||||
4, // 8: user.v1.UserService.UpdatePassword:output_type -> user.v1.UpdatePasswordResponse
|
||||
6, // 9: user.v1.UserService.GetAPIKey:output_type -> user.v1.GetAPIKeyResponse
|
||||
8, // 10: user.v1.UserService.UpdateProfilePicture:output_type -> user.v1.UpdateProfilePictureResponse
|
||||
7, // [7:11] is the sub-list for method output_type
|
||||
3, // [3:7] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_user_v1_user_proto_init() }
|
||||
@ -295,13 +586,14 @@ func file_user_v1_user_proto_init() {
|
||||
if File_user_v1_user_proto != nil {
|
||||
return
|
||||
}
|
||||
file_user_v1_user_proto_msgTypes[0].OneofWrappers = []any{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_user_v1_user_proto_rawDesc), len(file_user_v1_user_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
@ -33,17 +33,24 @@ const (
|
||||
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
|
||||
// period.
|
||||
const (
|
||||
// UserServiceChangePasswordProcedure is the fully-qualified name of the UserService's
|
||||
// ChangePassword RPC.
|
||||
UserServiceChangePasswordProcedure = "/user.v1.UserService/ChangePassword"
|
||||
// UserServiceAPIKeyProcedure is the fully-qualified name of the UserService's APIKey RPC.
|
||||
UserServiceAPIKeyProcedure = "/user.v1.UserService/APIKey"
|
||||
// UserServiceGetUserProcedure is the fully-qualified name of the UserService's GetUser RPC.
|
||||
UserServiceGetUserProcedure = "/user.v1.UserService/GetUser"
|
||||
// UserServiceUpdatePasswordProcedure is the fully-qualified name of the UserService's
|
||||
// UpdatePassword RPC.
|
||||
UserServiceUpdatePasswordProcedure = "/user.v1.UserService/UpdatePassword"
|
||||
// UserServiceGetAPIKeyProcedure is the fully-qualified name of the UserService's GetAPIKey RPC.
|
||||
UserServiceGetAPIKeyProcedure = "/user.v1.UserService/GetAPIKey"
|
||||
// UserServiceUpdateProfilePictureProcedure is the fully-qualified name of the UserService's
|
||||
// UpdateProfilePicture RPC.
|
||||
UserServiceUpdateProfilePictureProcedure = "/user.v1.UserService/UpdateProfilePicture"
|
||||
)
|
||||
|
||||
// UserServiceClient is a client for the user.v1.UserService service.
|
||||
type UserServiceClient interface {
|
||||
ChangePassword(context.Context, *connect.Request[v1.ChangePasswordRequest]) (*connect.Response[v1.ChangePasswordResponse], error)
|
||||
APIKey(context.Context, *connect.Request[v1.APIKeyRequest]) (*connect.Response[v1.APIKeyResponse], error)
|
||||
GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.GetUserResponse], error)
|
||||
UpdatePassword(context.Context, *connect.Request[v1.UpdatePasswordRequest]) (*connect.Response[v1.UpdatePasswordResponse], error)
|
||||
GetAPIKey(context.Context, *connect.Request[v1.GetAPIKeyRequest]) (*connect.Response[v1.GetAPIKeyResponse], error)
|
||||
UpdateProfilePicture(context.Context, *connect.Request[v1.UpdateProfilePictureRequest]) (*connect.Response[v1.UpdateProfilePictureResponse], error)
|
||||
}
|
||||
|
||||
// NewUserServiceClient constructs a client for the user.v1.UserService service. By default, it uses
|
||||
@ -57,16 +64,28 @@ func NewUserServiceClient(httpClient connect.HTTPClient, baseURL string, opts ..
|
||||
baseURL = strings.TrimRight(baseURL, "/")
|
||||
userServiceMethods := v1.File_user_v1_user_proto.Services().ByName("UserService").Methods()
|
||||
return &userServiceClient{
|
||||
changePassword: connect.NewClient[v1.ChangePasswordRequest, v1.ChangePasswordResponse](
|
||||
getUser: connect.NewClient[v1.GetUserRequest, v1.GetUserResponse](
|
||||
httpClient,
|
||||
baseURL+UserServiceChangePasswordProcedure,
|
||||
connect.WithSchema(userServiceMethods.ByName("ChangePassword")),
|
||||
baseURL+UserServiceGetUserProcedure,
|
||||
connect.WithSchema(userServiceMethods.ByName("GetUser")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
aPIKey: connect.NewClient[v1.APIKeyRequest, v1.APIKeyResponse](
|
||||
updatePassword: connect.NewClient[v1.UpdatePasswordRequest, v1.UpdatePasswordResponse](
|
||||
httpClient,
|
||||
baseURL+UserServiceAPIKeyProcedure,
|
||||
connect.WithSchema(userServiceMethods.ByName("APIKey")),
|
||||
baseURL+UserServiceUpdatePasswordProcedure,
|
||||
connect.WithSchema(userServiceMethods.ByName("UpdatePassword")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
getAPIKey: connect.NewClient[v1.GetAPIKeyRequest, v1.GetAPIKeyResponse](
|
||||
httpClient,
|
||||
baseURL+UserServiceGetAPIKeyProcedure,
|
||||
connect.WithSchema(userServiceMethods.ByName("GetAPIKey")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
updateProfilePicture: connect.NewClient[v1.UpdateProfilePictureRequest, v1.UpdateProfilePictureResponse](
|
||||
httpClient,
|
||||
baseURL+UserServiceUpdateProfilePictureProcedure,
|
||||
connect.WithSchema(userServiceMethods.ByName("UpdateProfilePicture")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
}
|
||||
@ -74,24 +93,38 @@ func NewUserServiceClient(httpClient connect.HTTPClient, baseURL string, opts ..
|
||||
|
||||
// userServiceClient implements UserServiceClient.
|
||||
type userServiceClient struct {
|
||||
changePassword *connect.Client[v1.ChangePasswordRequest, v1.ChangePasswordResponse]
|
||||
aPIKey *connect.Client[v1.APIKeyRequest, v1.APIKeyResponse]
|
||||
getUser *connect.Client[v1.GetUserRequest, v1.GetUserResponse]
|
||||
updatePassword *connect.Client[v1.UpdatePasswordRequest, v1.UpdatePasswordResponse]
|
||||
getAPIKey *connect.Client[v1.GetAPIKeyRequest, v1.GetAPIKeyResponse]
|
||||
updateProfilePicture *connect.Client[v1.UpdateProfilePictureRequest, v1.UpdateProfilePictureResponse]
|
||||
}
|
||||
|
||||
// ChangePassword calls user.v1.UserService.ChangePassword.
|
||||
func (c *userServiceClient) ChangePassword(ctx context.Context, req *connect.Request[v1.ChangePasswordRequest]) (*connect.Response[v1.ChangePasswordResponse], error) {
|
||||
return c.changePassword.CallUnary(ctx, req)
|
||||
// GetUser calls user.v1.UserService.GetUser.
|
||||
func (c *userServiceClient) GetUser(ctx context.Context, req *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.GetUserResponse], error) {
|
||||
return c.getUser.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// APIKey calls user.v1.UserService.APIKey.
|
||||
func (c *userServiceClient) APIKey(ctx context.Context, req *connect.Request[v1.APIKeyRequest]) (*connect.Response[v1.APIKeyResponse], error) {
|
||||
return c.aPIKey.CallUnary(ctx, req)
|
||||
// UpdatePassword calls user.v1.UserService.UpdatePassword.
|
||||
func (c *userServiceClient) UpdatePassword(ctx context.Context, req *connect.Request[v1.UpdatePasswordRequest]) (*connect.Response[v1.UpdatePasswordResponse], error) {
|
||||
return c.updatePassword.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// GetAPIKey calls user.v1.UserService.GetAPIKey.
|
||||
func (c *userServiceClient) GetAPIKey(ctx context.Context, req *connect.Request[v1.GetAPIKeyRequest]) (*connect.Response[v1.GetAPIKeyResponse], error) {
|
||||
return c.getAPIKey.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// UpdateProfilePicture calls user.v1.UserService.UpdateProfilePicture.
|
||||
func (c *userServiceClient) UpdateProfilePicture(ctx context.Context, req *connect.Request[v1.UpdateProfilePictureRequest]) (*connect.Response[v1.UpdateProfilePictureResponse], error) {
|
||||
return c.updateProfilePicture.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// UserServiceHandler is an implementation of the user.v1.UserService service.
|
||||
type UserServiceHandler interface {
|
||||
ChangePassword(context.Context, *connect.Request[v1.ChangePasswordRequest]) (*connect.Response[v1.ChangePasswordResponse], error)
|
||||
APIKey(context.Context, *connect.Request[v1.APIKeyRequest]) (*connect.Response[v1.APIKeyResponse], error)
|
||||
GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.GetUserResponse], error)
|
||||
UpdatePassword(context.Context, *connect.Request[v1.UpdatePasswordRequest]) (*connect.Response[v1.UpdatePasswordResponse], error)
|
||||
GetAPIKey(context.Context, *connect.Request[v1.GetAPIKeyRequest]) (*connect.Response[v1.GetAPIKeyResponse], error)
|
||||
UpdateProfilePicture(context.Context, *connect.Request[v1.UpdateProfilePictureRequest]) (*connect.Response[v1.UpdateProfilePictureResponse], error)
|
||||
}
|
||||
|
||||
// NewUserServiceHandler builds an HTTP handler from the service implementation. It returns the path
|
||||
@ -101,24 +134,40 @@ type UserServiceHandler interface {
|
||||
// and JSON codecs. They also support gzip compression.
|
||||
func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
||||
userServiceMethods := v1.File_user_v1_user_proto.Services().ByName("UserService").Methods()
|
||||
userServiceChangePasswordHandler := connect.NewUnaryHandler(
|
||||
UserServiceChangePasswordProcedure,
|
||||
svc.ChangePassword,
|
||||
connect.WithSchema(userServiceMethods.ByName("ChangePassword")),
|
||||
userServiceGetUserHandler := connect.NewUnaryHandler(
|
||||
UserServiceGetUserProcedure,
|
||||
svc.GetUser,
|
||||
connect.WithSchema(userServiceMethods.ByName("GetUser")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
userServiceAPIKeyHandler := connect.NewUnaryHandler(
|
||||
UserServiceAPIKeyProcedure,
|
||||
svc.APIKey,
|
||||
connect.WithSchema(userServiceMethods.ByName("APIKey")),
|
||||
userServiceUpdatePasswordHandler := connect.NewUnaryHandler(
|
||||
UserServiceUpdatePasswordProcedure,
|
||||
svc.UpdatePassword,
|
||||
connect.WithSchema(userServiceMethods.ByName("UpdatePassword")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
userServiceGetAPIKeyHandler := connect.NewUnaryHandler(
|
||||
UserServiceGetAPIKeyProcedure,
|
||||
svc.GetAPIKey,
|
||||
connect.WithSchema(userServiceMethods.ByName("GetAPIKey")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
userServiceUpdateProfilePictureHandler := connect.NewUnaryHandler(
|
||||
UserServiceUpdateProfilePictureProcedure,
|
||||
svc.UpdateProfilePicture,
|
||||
connect.WithSchema(userServiceMethods.ByName("UpdateProfilePicture")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
return "/user.v1.UserService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case UserServiceChangePasswordProcedure:
|
||||
userServiceChangePasswordHandler.ServeHTTP(w, r)
|
||||
case UserServiceAPIKeyProcedure:
|
||||
userServiceAPIKeyHandler.ServeHTTP(w, r)
|
||||
case UserServiceGetUserProcedure:
|
||||
userServiceGetUserHandler.ServeHTTP(w, r)
|
||||
case UserServiceUpdatePasswordProcedure:
|
||||
userServiceUpdatePasswordHandler.ServeHTTP(w, r)
|
||||
case UserServiceGetAPIKeyProcedure:
|
||||
userServiceGetAPIKeyHandler.ServeHTTP(w, r)
|
||||
case UserServiceUpdateProfilePictureProcedure:
|
||||
userServiceUpdateProfilePictureHandler.ServeHTTP(w, r)
|
||||
default:
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
@ -128,10 +177,18 @@ func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption
|
||||
// UnimplementedUserServiceHandler returns CodeUnimplemented from all methods.
|
||||
type UnimplementedUserServiceHandler struct{}
|
||||
|
||||
func (UnimplementedUserServiceHandler) ChangePassword(context.Context, *connect.Request[v1.ChangePasswordRequest]) (*connect.Response[v1.ChangePasswordResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("user.v1.UserService.ChangePassword is not implemented"))
|
||||
func (UnimplementedUserServiceHandler) GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.GetUserResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("user.v1.UserService.GetUser is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedUserServiceHandler) APIKey(context.Context, *connect.Request[v1.APIKeyRequest]) (*connect.Response[v1.APIKeyResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("user.v1.UserService.APIKey is not implemented"))
|
||||
func (UnimplementedUserServiceHandler) UpdatePassword(context.Context, *connect.Request[v1.UpdatePasswordRequest]) (*connect.Response[v1.UpdatePasswordResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("user.v1.UserService.UpdatePassword is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedUserServiceHandler) GetAPIKey(context.Context, *connect.Request[v1.GetAPIKeyRequest]) (*connect.Response[v1.GetAPIKeyResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("user.v1.UserService.GetAPIKey is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedUserServiceHandler) UpdateProfilePicture(context.Context, *connect.Request[v1.UpdateProfilePictureRequest]) (*connect.Response[v1.UpdateProfilePictureResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("user.v1.UserService.UpdateProfilePicture is not implemented"))
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"embed"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -21,7 +20,6 @@ import (
|
||||
|
||||
"github.com/spotdemo4/trevstack/server/internal/database"
|
||||
"github.com/spotdemo4/trevstack/server/internal/handlers"
|
||||
"github.com/spotdemo4/trevstack/server/internal/interceptors"
|
||||
)
|
||||
|
||||
//go:embed all:client
|
||||
@ -118,11 +116,8 @@ func main() {
|
||||
|
||||
// Serve web interface
|
||||
mux := http.NewServeMux()
|
||||
clientFs, err := fs.Sub(client, "client")
|
||||
if err != nil {
|
||||
log.Fatalf("failed to get sub filesystem: %v", err)
|
||||
}
|
||||
mux.Handle("/", interceptors.WithAuthRedirect(http.FileServer(http.FS(clientFs)), env.Key))
|
||||
mux.Handle("/", handlers.NewClientHandler(client, env.Key))
|
||||
mux.Handle("/file/", handlers.NewFileHandler(db, env.Key))
|
||||
mux.Handle("/grpc/", http.StripPrefix("/grpc", api))
|
||||
|
||||
// Start server
|
||||
|
Reference in New Issue
Block a user