Documentation
¶
Index ¶
- func GetAvatarFromMultipartForm(r *http.Request) (*models.File, error)
- func GetRequestBody[T any](r *http.Request) (*T, error)
- func GetScanFromMultipartForm(r *http.Request) (*models.File, error)
- type AdminUserDetailResponse
- type AdminUserListResponse
- type AdminUserParams
- type AdminUserResponse
- type AuthRequest
- type AuthResponse
- type ChangePasswordRequest
- type CreateAdminRequest
- type HTTPResource
- type LoginUserRequest
- type PredictionResponse
- type StatResponse
- type UpdateUserRequest
- type UploadAvatarRequest
- type UploadAvatarResponse
- type UserResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AdminUserDetailResponse ¶ added in v0.0.5
type AdminUserDetailResponse struct {
AdminUserResponse
Predictions []PredictionResponse `json:"predictions"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
func NewAdminUserDetailResponse ¶ added in v0.0.5
func NewAdminUserDetailResponse( user models.User, predictions []*models.Prediction, limit, offset int, ) AdminUserDetailResponse
type AdminUserListResponse ¶ added in v0.0.5
type AdminUserListResponse struct {
TotalCount int64 `json:"total_count"`
Limit int `json:"limit"`
Offset int `json:"offset"`
Users []AdminUserResponse `json:"users"`
}
func NewAdminUserListResponse ¶ added in v0.0.5
func NewAdminUserListResponse(users []models.User, totalCount int64, limit, offset int) AdminUserListResponse
type AdminUserParams ¶ added in v0.0.5
type AdminUserResponse ¶ added in v0.0.5
type AdminUserResponse struct {
ID uuid.UUID `json:"id"`
Login string `json:"login"`
Name string `json:"name"`
Role models.Role `json:"role"`
Avatar *string `json:"avatar,omitempty"`
Deleted bool `json:"deleted"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastLoginAt *time.Time `json:"last_login_at,omitempty"`
Stat *StatResponse `json:"stat,omitempty"`
}
func NewAdminUserResponse ¶ added in v0.0.5
func NewAdminUserResponse(user models.User) AdminUserResponse
type AuthRequest ¶
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 CreateAdminRequest ¶ added in v0.0.5
type CreateAdminRequest struct {
Name string `json:"name" validate:"required,min=2,max=100"`
Login string `json:"login" validate:"required,alphanum,min=3,max=50"`
Password string `json:"password" validate:"required,min=8"`
Role models.Role `json:"role" validate:"required"`
}
func (*CreateAdminRequest) ToModel ¶ added in v0.0.5
func (req *CreateAdminRequest) ToModel() *models.User
type HTTPResource ¶
type HTTPResource interface {
LoginUserRequest | ChangePasswordRequest | UpdateUserRequest
}
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 StatResponse ¶ added in v0.0.5
type UpdateUserRequest ¶ added in v0.0.3
type UpdateUserRequest struct {
Name string `json:"name" validate:"required,min=3,max=64,alphanum"`
}
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 ¶
Click to show internal directories.
Click to hide internal directories.