data

package
v0.0.0-...-7e02f77 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateStruct

func ValidateStruct(s interface{}) (map[string]string, error)

Types

type LoginRegisterResponse

type LoginRegisterResponse struct {
	Message string         `json:"message"`
	User    *User          `json:"user"`
	Tokens  *SessionTokens `json:"tokens"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" validate:"required,min=5"`
	Password string `json:"password" validate:"required,min=6"`
}

type RegisterRequest

type RegisterRequest struct {
	Username  string `json:"username" validate:"required,min=5"`
	Email     string `json:"email" validate:"required,email"`
	Password  string `json:"password" validate:"required,min=6"`
	FirstName string `json:"first_name" validate:"required,min=3"`
	LastName  string `json:"last_name" validate:"required,min=3"`
}

type SessionTokens

type SessionTokens struct {
	AccessToken      string    `json:"access_token"`
	AccessCreatedAt  time.Time `json:"access_created_at"`
	AccessExpiresAt  time.Time `json:"access_expires_at"`
	RefreshToken     string    `json:"refresh_token"`
	RefreshCreatedAt time.Time `json:"refresh_created_at"`
	RefreshExpiresAt time.Time `json:"refresh_expires_at"`
}

type TokenResponse

type TokenResponse struct {
	Message string         `json:"message"`
	Tokens  *SessionTokens `json:"tokens"`
}

type UpdateRequest

type UpdateRequest struct {
	Username  string `json:"username,omitempty" validate:"omitempty,min=5"`
	Email     string `json:"email,omitempty" validate:"omitempty,email"`
	Password  string `json:"password,omitempty" validate:"omitempty,min=6"`
	FirstName string `json:"first_name,omitempty" validate:"omitempty,min=3"`
	LastName  string `json:"last_name,omitempty" validate:"omitempty,min=3"`
}

type User

type User struct {
	ID         primitive.ObjectID `json:"id" bson:"_id"`
	Username   string             `json:"username" bson:"username"`
	Email      string             `json:"email" bson:"email"`
	Hash       string             `json:"-" bson:"hash"`
	FirstName  string             `json:"first_name" bson:"first_name"`
	LastName   string             `json:"last_name" bson:"last_name"`
	DateJoined time.Time          `json:"date_joined" bson:"date_joined"`
}

Jump to

Keyboard shortcuts

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