dto

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAvatarFromMultipartForm

func GetAvatarFromMultipartForm(r *http.Request) (*models.File, error)

func GetRequestBody

func GetRequestBody[T any](r *http.Request) (*T, error)

func GetScanFromMultipartForm

func GetScanFromMultipartForm(r *http.Request) (*models.File, error)

Types

type AuthRequest

type AuthRequest struct {
	Login    string `json:"login"`
	Password string `json:"password"`
}

type AuthResponse

type AuthResponse struct {
	User struct {
		ID    string `json:"id"`
		Login string `json:"login"`
	} `json:"user"`
}

func NewAuthResponse

func NewAuthResponse(user models.User, access, refresh string) AuthResponse

type ChangePasswordRequest

type ChangePasswordRequest struct {
	OldPassword string `json:"old_password" validate:"required,min=8,max=64"`
	NewPassword string `json:"new_password" validate:"required,min=8,max=64,nefield=OldPassword"`
}

type HTTPResource

type HTTPResource interface {
	LoginUserRequest | ChangePasswordRequest
}

type LoginUserRequest

type LoginUserRequest struct {
	Login    string `json:"login" validate:"required,min=3,max=32,alphanum"`
	Password string `json:"password" validate:"required,min=8,max=64"`
	Name     string `json:"name,omitempty" validate:"omitempty,min=3,max=64,alphanum"`
}

func (*LoginUserRequest) ToModel

func (r *LoginUserRequest) ToModel() models.User

type PredictionResponse

type PredictionResponse models.Prediction

type UploadAvatarRequest

type UploadAvatarRequest struct {
	Avatar string `json:"avatar" swaggertype:"string" format:"binary" example:"avatar.jpg" validate:"required"`
}

type UploadAvatarResponse

type UploadAvatarResponse struct {
	AvatarURL string `json:"avatar_url" example:"http://localhost:9000/trashscanner-images/user-id/avatars/avatar.jpg"`
}

type UserResponse

type UserResponse models.User

Jump to

Keyboard shortcuts

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