Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyRoutes ¶
func ApplyRoutes(app *fiber.App, logger *zap.Logger, mongoCollection *mongo.Collection)
Types ¶
type Aditional ¶
type Aditional struct {
Email string `bson:"email,omitempty" json:"email" validate:"required,email"`
}
type Cases ¶
type Cases interface { Register(ctx context.Context, user *User) (User, error) Login(ctx context.Context, user *User) (User, error) GetUserById(ctx context.Context, id string) (User, error) GetUserByEmail(ctx context.Context, email string) (User, error) Deactivate(ctx context.Context, id string) error Activate(ctx context.Context, id string) error Update(ctx context.Context, id string, user *User) error }
type Controller ¶
type Controller interface { Register(ctx *fiber.Ctx) error Login(ctx *fiber.Ctx) error GetUserById(ctx *fiber.Ctx) error GetUserByEmail(ctx *fiber.Ctx) error Deactivate(ctx *fiber.Ctx) error Activate(ctx *fiber.Ctx) error Update(ctx *fiber.Ctx) error }
func NewController ¶
func NewController(cases Cases) Controller
type Repository ¶
type Repository interface { CreateUser(ctx context.Context, user *User) error UpdateUser(ctx context.Context, user *User) error GetUserById(ctx context.Context, id string) (User, error) GetUserByEmail(ctx context.Context, email string) (User, error) Deactivate(ctx context.Context, id string) error Activate(ctx context.Context, id string) error }
func NewRepository ¶
func NewRepository(logger *zap.Logger, collection *mongo.Collection) Repository
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` Name string `bson:"name,omitempty" json:"name"` Email string `bson:"email,omitempty" json:"email"` Password string `bson:"password,omitempty" json:"password,omitempty"` IsDeleted bool `bson:"is_deleted,omitempty" json:"is_deleted"` LastLogin primitive.DateTime `bson:"last_login,omitempty" json:"last_login"` CreatedAt primitive.DateTime `bson:"created_at,omitempty" json:"created_at" default:"now()"` UpdatedAt primitive.DateTime `bson:"updated_at,omitempty" json:"updated_at" default:"now()"` DeleteAt primitive.DateTime `bson:"delete_at,omitempty" json:"delete_at"` }
type UserCreateRequest ¶
type UserCreateRequest struct { Name string `bson:"name,omitempty" json:"name" validate:"required"` Email string `bson:"email,omitempty" json:"email" validate:"required,email"` Password string `bson:"password,omitempty" json:"password,omitempty" validate:"required"` Aditional Aditional `bson:"aditional,omitempty" json:"aditional" validate:"required"` }
Request
type UserCreateResponse ¶
type UserLoginResponse ¶
type UserLoginResponse struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` Name string `bson:"name,omitempty" json:"name"` Email string `bson:"email,omitempty" json:"email"` Password string `bson:"password,omitempty" json:"password,omitempty"` LastLogin primitive.DateTime `bson:"last_login,omitempty" json:"last_login"` CreatedAt primitive.DateTime `bson:"created_at,omitempty" json:"created_at" default:"now()"` UpdatedAt primitive.DateTime `bson:"updated_at,omitempty" json:"updated_at" default:"now()"` }
type UserRequest ¶
type UserRequest struct { Email string `bson:"email,omitempty" json:"email" validate:"required,email"` Password string `bson:"password,omitempty" json:"password,omitempty" validate:"required"` LastLogin primitive.DateTime `bson:"last_login,omitempty" json:"last_login"` CreatedAt primitive.DateTime `bson:"created_at,omitempty" json:"created_at" default:"now()"` UpdatedAt primitive.DateTime `bson:"updated_at,omitempty" json:"updated_at" default:"now()"` DeleteAt primitive.DateTime `bson:"delete_at,omitempty" json:"delete_at"` }
type UserResponse ¶
type UserResponse struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` Name string `bson:"name,omitempty" json:"name"` Email string `bson:"email,omitempty" json:"email"` Password string `bson:"password,omitempty" json:"password,omitempty"` IsDeleted bool `bson:"is_deleted,omitempty" json:"is_deleted"` LastLogin primitive.DateTime `bson:"last_login,omitempty" json:"last_login"` CreatedAt primitive.DateTime `bson:"created_at,omitempty" json:"created_at" default:"now()"` UpdatedAt primitive.DateTime `bson:"updated_at,omitempty" json:"updated_at" default:"now()"` DeleteAt primitive.DateTime `bson:"delete_at,omitempty" json:"delete_at"` }
Response
type UserUpdateRequest ¶
Click to show internal directories.
Click to hide internal directories.