model

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmailRegistration  = "registration"
	EmailResetPassword = "reset_password"
)

Email types used in the application.

Variables

This section is empty.

Functions

func AuthenticateRequestToProto

func AuthenticateRequestToProto(req *AuthenticateRequest) *gen.AuthenticateRequest

func AuthenticateResultToProto

func AuthenticateResultToProto(req *AuthenticateResult) *gen.AuthenticateResponse

func HealthStatusToProto

func HealthStatusToProto(status *HealthStatus) *gen.HealthResponse

HealthStatusToProto converts HealthStatus model to gen.HealthResponse

func PasswordRecoveryRequestToProto

func PasswordRecoveryRequestToProto(req *RecoverPasswordRequest) *gen.PasswordRecoveryRequest

func RegisterRequestToProto

func RegisterRequestToProto(req *RegisterRequest) *gen.RegisterRequest

func UserToProto

func UserToProto(u *User) *gen.ProfileResponse

Types

type AuthenticateRequest

type AuthenticateRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`

	RememberMe bool   `json:"remember_me"`
	UserAgent  string `json:"user_agent"`
	IpAddress  string `json:"ip_address"`

	Subject   string   `json:"subject"`
	ExpiresIn int64    `json:"expires_in"`
	Audience  []string `json:"audience"`

	Method int `json:"method"`
}

AuthenticateRequest represents the data structure for user authentication requests.

func AuthenticateRequestFromProto

func AuthenticateRequestFromProto(p *gen.AuthenticateRequest) *AuthenticateRequest

type AuthenticateResult

type AuthenticateResult struct {
	UserId         int32     `json:"user_id" yaml:"user_id"`
	TokenId        string    `json:"token_id" yaml:"token_id"`
	Code           string    `json:"code" yaml:"code"`
	AccessToken    string    `json:"access_token" yaml:"access_token"`
	ExpirationTime time.Time `json:"expiration_time" yaml:"expiration_time"`
}

AuthenticateResult represents the result of a successful authentication.

func AuthenticateResultFromProto

func AuthenticateResultFromProto(p *gen.AuthenticateResponse) *AuthenticateResult

type ChangePasswordRequest

type ChangePasswordRequest struct {
	OldPassword    string `json:"old_password"`
	NewPassword    string `json:"new_password"`
	RepeatPassword string `json:"repeat_password"`
}

ChangePasswordRequest represents a request to change the user's password.

type EmailAddrSpec

type EmailAddrSpec struct {
	Email string `json:"email" yaml:"email"`
	Name  string `json:"name" yaml:"name"`
}

EmailAddrSpec represents an email address with an optional name.

type EmailData

type EmailData struct {
	Sender    EmailAddrSpec `json:"sender" yaml:"sender"`
	Recipient EmailAddrSpec `json:"recipient" yaml:"recipient"`
	Subject   string        `json:"subject" yaml:"subject"`
	Token     string        `json:"token" yaml:"token"`
	Url       string        `json:"url" yaml:"url"`
}

EmailData represents the data structure for sending emails in the application.

type HealthStatus

type HealthStatus struct {
	AppDevVersion string `json:"app_dev_version"`
	AppName       string `json:"app_name"`
	AppRunDate    int64  `json:"app_run_date"`
	AppTimeAlive  int64  `json:"app_time_alive"`
	Healthy       bool   `json:"healthy"`
	Message       string `json:"message"`
	Timestamp     string `json:"timestamp"`
}

type ListRequest

type ListRequest struct {
	Limit        int32 `json:"limit" yaml:"limit"`
	Offset       int32 `json:"offset" yaml:"offset"`
	CreatedFrom  int64 `json:"created_at" yaml:"created_at"`
	CreatedUntil int64 `json:"created_until" yaml:"created_until"`
	UpdatedFrom  int64 `json:"updated_at" yaml:"updated_at"`
	UpdatedUntil int64 `json:"updated_until" yaml:"updated_until"`
}

ListRequest provides parameters for listing entities with optional time range filtering.

type RecoverPasswordRequest

type RecoverPasswordRequest struct {
	Token           string `json:"token"`
	Password        string `json:"password"`
	ConfirmPassword string `json:"confirm_password"`
}

RecoverPasswordRequest represents a request to recover the password after initiating the reset process.

type RegisterRequest

type RegisterRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Name     string `json:"name"`
	TermsOk  bool   `json:"terms_ok"`

	Token string `json:"token"`
}

RegisterRequest represents the data structure for handling user registration requests.

func RegisterRequestFromProto

func RegisterRequestFromProto(p *gen.RegisterRequest) *RegisterRequest

type ResetPasswordRequest

type ResetPasswordRequest struct {
	Email string `json:"email"`
}

ResetPasswordRequest represents a request to initiate the password reset process.

type TokenType

type TokenType string

TokenType represents the type for distinguishing token types in the application.

const (
	TokenConfirmation  TokenType = "user_registration_confirmation"
	TokenResetPassword TokenType = "reset_password"
	TokenSetPassword   TokenType = "set_password"
)

Constants for various token types.

type User

type User struct {
	UserId    int32  `json:"user_id,omitempty" yaml:"user_id,omitempty"`
	Name      string `json:"name,omitempty" yaml:"name,omitempty"`
	Email     string `json:"email,omitempty" yaml:"email,omitempty"`
	Rank      string `json:"rank,omitempty" yaml:"rank,omitempty"`
	Claim     string `json:"claim,omitempty" yaml:"claim,omitempty"`
	Roles     uint64 `json:"roles,omitempty" yaml:"roles,omitempty"`
	Flags     uint64 `json:"flags,omitempty" yaml:"flags,omitempty"`
	CreatedAt int64  `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	UpdatedAt int64  `json:"updated_at,omitempty" yaml:"updated_at,omitempty"`
}

User represents all user properties

func UserFromProto

func UserFromProto(p *gen.ProfileResponse) *User

type UserCredentials

type UserCredentials struct {
	UserId      int32     `json:"user_id"`
	Email       string    `json:"email"`
	Password    string    `json:"-"`
	Salt        string    `json:"-"`
	Token       string    `json:"-"`
	TokenType   TokenType `json:"token_type"`
	TokenExpire int64     `json:"token_expire"`
	Active      bool      `json:"active"`
}

UserCredentials represents user authentication credentials and related information.

type UserCredentialsRequest

type UserCredentialsRequest struct {
	UserId    int32     `json:"user_id"`
	Email     string    `json:"email"`
	Token     string    `json:"token"`
	TokenType TokenType `json:"token_type"`
	IsActive  int32     `json:"is_active"`
}

UserCredentialsRequest represents a request for retrieving user authentication credentials.

type UserRequest

type UserRequest struct {
	UserId int32  `json:"user_id,omitempty" yaml:"user_id,omitempty"`
	Name   string `json:"name,omitempty" yaml:"name,omitempty"`
}

UserRequest represents a request for user information.

type UserResult

type UserResult struct {
	User     User          `json:"user"`
	Settings *UserSettings `json:"settings,omitempty"`
}

UsersRequest represents a request for multiple users' information.

type UserSettings

type UserSettings struct {
	UserId     int32  `json:"user_id"`
	LoginEmail string `json:"login_email"`
	WebFlags   uint64 `json:"web_flags"`
	EmailFlags uint64 `json:"email_flags"`
	UpdatedAt  int64  `json:"updated_at"`
}

UserSetttings represents user settings

type UsersRequest

type UsersRequest struct {
	UserIds           []int32 `json:"user_ids,omitempty" yaml:"user_ids,omitempty"`
	Name              string  `json:"name,omitempty" yaml:"name,omitempty"`
	Email             string  `json:"email,omitempty" yaml:"email,omitempty"`
	LastActivityFrom  int64   `json:"last_activity_from,omitempty" yaml:"last_activity_from,omitempty"`
	LastActivityUntil int64   `json:"last_activity_until,omitempty" yaml:"last_activity_until,omitempty"`
	ExtraData         bool    `json:"extra_data,omitempty" yaml:"extra_data,omitempty"`
	OnlyCount         bool    `json:"only_count,omitempty" yaml:"only_count,omitempty"`
	ListRequest
}

UsersRequest represents a request for multiple users' information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL