dto

package
v0.0.0-...-cb12e15 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ID        primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	Email     string             `json:"email" bson:"email"`
	Name      string             `json:"name" bson:"name"`
	IsAdmin   bool               `json:"is_admin" bson:"is_admin"`
	Avatar    string             `json:"avatar" bson:"avatar"`
	HashPw    string             `json:"hash_pw,omitempty" bson:"hash_pw,omitempty"`
	Timestamp int64              `json:"timestamp" bson:"timestamp"`
}

User struct lengkap dari document user di Mongodb

type UserChangePasswordRequest

type UserChangePasswordRequest struct {
	Email       string `json:"email"`
	Password    string `json:"password"`
	NewPassword string `json:"new_password"`
}

UserChangePasswordRequest struck untuk keperluan change password dan reset password pada reset password hanya menggunakan NewPassword dan mengabaikan Password

func (UserChangePasswordRequest) Validate

func (u UserChangePasswordRequest) Validate() error

Validate input

type UserEditRequest

type UserEditRequest struct {
	Name            string `json:"name" bson:"name"`
	IsAdmin         bool   `json:"is_admin" bson:"is_admin"`
	TimestampFilter int64  `json:"timestamp_filter" bson:"timestamp"`
}

UserEditRequest input JSON oleh admin untuk mengedit user

func (UserEditRequest) Validate

func (u UserEditRequest) Validate() error

type UserLoginRequest

type UserLoginRequest struct {
	Email    string `json:"email" bson:"email"`
	Password string `json:"password" bson:"password"`
	Limit    int    `json:"limit"`
}

UserLoginRequest input JSON oleh client untuk keperluan login

func (UserLoginRequest) Validate

func (u UserLoginRequest) Validate() error

Validate input

type UserLoginResponse

type UserLoginResponse struct {
	Email        string `json:"email" bson:"email"`
	Name         string `json:"name" bson:"name"`
	IsAdmin      bool   `json:"is_admin" bson:"is_admin"`
	Avatar       string `json:"avatar" bson:"avatar"`
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	Expired      int64  `json:"expired"`
}

UserLoginResponse balikan user ketika sukses login dengan tambahan AccessToken

type UserRefreshTokenRequest

type UserRefreshTokenRequest struct {
	RefreshToken string `json:"refresh_token"`
	Limit        int    `json:"limit"`
}

func (UserRefreshTokenRequest) Validate

func (u UserRefreshTokenRequest) Validate() error

Validate input

type UserRefreshTokenResponse

type UserRefreshTokenResponse struct {
	AccessToken string `json:"access_token"`
	Expired     int64  `json:"expired"`
}

UserRefreshTokenResponse mengembalikan token dengan claims yang sama dengan token sebelumnya dengan expired yang baru

type UserRequest

type UserRequest struct {
	Email     string `json:"email" bson:"email"`
	Name      string `json:"name" bson:"name"`
	IsAdmin   bool   `json:"is_admin" bson:"is_admin"`
	Avatar    string `json:"avatar" bson:"avatar"`
	Password  string `json:"password" bson:"password"`
	Timestamp int64  `json:"timestamp" bson:"timestamp"`
}

UserRequest input JSON untuk keperluan register, timestamp dapat diabaikan

func (UserRequest) Validate

func (u UserRequest) Validate() error

Validate input

type UserResponse

type UserResponse struct {
	ID        primitive.ObjectID `json:"id" bson:"_id"`
	Email     string             `json:"email" bson:"email"`
	Name      string             `json:"name" bson:"name"`
	IsAdmin   bool               `json:"is_admin" bson:"is_admin"`
	Avatar    string             `json:"avatar" bson:"avatar"`
	Timestamp int64              `json:"timestamp" bson:"timestamp"`
}

UserResponse struct kembalian dari MongoDB dengan menghilangkan hashPassword

type UserResponseList

type UserResponseList []UserResponse

UserResponseList tipe slice dari UserResponse

Jump to

Keyboard shortcuts

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