szuntis-backend/repository/auth.go
KoCoder 1e41dd833f
Some checks failed
build-docker-imge / Build the docker container (push) Failing after 2m24s
Experiment with Authentication and Websockets
2024-08-27 18:20:17 +02:00

37 lines
934 B
Go

package repository
import (
"context"
"github.com/google/uuid"
)
type LoginParams struct {
LoginName string `json:"loginname"`
Password string `json:"password"`
}
type RegisterParams struct {
Username string `json:"username"`
FirstName string `json:"firstname"`
LastName string `json:"lastname"`
LoginName string `json:"loginname"`
EmailAddress string `json:"emailaddress"`
Password string `json:"password"`
}
type User struct {
Username string `json:"username"`
FirstName string `json:"firstname"`
LastName string `json:"lastname"`
LoginName string `json:"loginname"`
EmailAddress string `json:"email"`
Password []byte
}
type AuthRepository interface {
GetUserByToken(ctx context.Context, userId uuid.UUID) (User, error)
Login(ctx context.Context, loginParams *LoginParams) (uuid.UUID, error)
Register(ctx context.Context, registerParams *RegisterParams) (bool, error)
}