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
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
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