new file: main_dc/yalarba/api_es/internal/models/user.go
modified: main_dc/yalarba/api_tp/internal/models/contacts.go modifay
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID uint `json:"id" gorm:"primarykey"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty" gorm:"index"`
|
||||
|
||||
Name string `json:"name" gorm:"size:100;not null"`
|
||||
FullName string `json:"full_name" gorm:"size:1000"`
|
||||
FirstName string `json:"first_name" gorm:"size:50"`
|
||||
LastName string `json:"last_nmae" gorm:"size:50"`
|
||||
Email string `json:"email" gorm:"size:255;uniqueIndex;not null"`
|
||||
Password string `json:"-" gorm:"size:255;not null"`
|
||||
}
|
||||
|
||||
type CreateUserRequest struct {
|
||||
Name string `json:"name" validate:"required,min=2,max=100"`
|
||||
Email string `json:"email" validate:"required,email"`
|
||||
Password string `json:"password" validate:"required,min=6"`
|
||||
}
|
||||
|
||||
type UpdateUserRequest struct {
|
||||
Name string `json:"name" validate:"omitempty,min=2,max=100"`
|
||||
Email string `json:"email" validate:"omitempty,email"`
|
||||
}
|
||||
|
||||
type UserResponse struct {
|
||||
ID uint `json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
}
|
||||
Reference in New Issue
Block a user