Versions in this module Expand all Collapse all v0 v0.1.0 Nov 22, 2023 Changes in this version + const ScopeActivation + const ScopeAuthentication + func ValidateTokenPlaintext(tokenPlaintext string) error + type Models struct + Roles RoleModel + Tokens TokenModel + Urls UrlModel + Users UserModel + func NewModels(db *gorm.DB) Models + type Role struct + Name string + type RoleModel struct + DB *gorm.DB + type Session struct + Data []byte + Expiry time.Time + Token string + type Token struct + Expiry time.Time + Hash []byte + Plaintext string + Scope string + User User + UserID uuid.UUID + type TokenModel struct + DB *gorm.DB + func (m TokenModel) DeleteAllForUser(scope string, userID uuid.UUID) error + func (m TokenModel) GetUserID(scope, token string) (uuid.UUID, error) + func (m TokenModel) Insert(token *Token) error + func (m TokenModel) New(userID uuid.UUID, ttl time.Duration, scope string) (*Token, error) + type Url struct + ID uuid.UUID + Original string + ShortUrl string + User User + UserID uuid.UUID + Visits int + type UrlByUserRequest struct + ID uuid.UUID + type UrlByUserResponse struct + CreatedAt time.Time + ID uuid.UUID + Original string + ShortUrl string + UpdatedAt time.Time + Visits int + type UrlCreateRequest struct + Original string + ShortCode string + UserID uuid.UUID + type UrlDeleteRequest struct + ID uuid.UUID + type UrlDeleteResponse struct + Message string + type UrlModel struct + DB *gorm.DB + func (u *UrlModel) Create(urlReq *UrlCreateRequest) (Url, error) + func (u *UrlModel) Delete(urlUUID uuid.UUID) error + func (u *UrlModel) Find(urlUUID uuid.UUID) *Url + func (u *UrlModel) GetRedirect(shortUrl string) (Url, error) + func (u *UrlModel) GetUrlByUser(userId uuid.UUID) (*[]UrlByUserResponse, error) + type UrlResponse struct + FullUrl string + ID uuid.UUID + type User struct + Activated bool + Email string + ID uuid.UUID + Name string + Password string + Role string + type UserLoginRequest struct + Email string + Password string + type UserLoginResponse struct + Email string + ID uuid.UUID + Token string + type UserModel struct + DB *gorm.DB + func (u *UserModel) Activate(id uuid.UUID) error + func (u *UserModel) GetByEmail(email string) (*User, error) + func (u *UserModel) GetByID(id uuid.UUID) (*User, error) + func (u *UserModel) GetRole(c echo.Context) (string, error) + func (u *UserModel) List() ([]User, error) + func (u *UserModel) Login(email, password string) (*User, error) + func (u *UserModel) Register(body *UserRegisterReq) (UserResponse, error) + type UserRegisterReq struct + Email string + Name string + Password string + PasswordConfirm string + type UserResponse struct + CreatedAt time.Time + Email string + ID uuid.UUID + Name string + UpdatedAt time.Time