add methods in Repository and Model for importing data
This commit is contained in:
@@ -52,6 +52,23 @@ type ProfileDTO struct {
|
||||
Enabled bool `json:"enabled" binding:"required"`
|
||||
}
|
||||
|
||||
func (profile *ProfileDTO) ConvertDTOToModel() Profile {
|
||||
model := Profile{
|
||||
ID: profile.ID,
|
||||
CreatedAt: profile.CreatedAt.Time,
|
||||
UpdatedAt: profile.UpdatedAt.Time,
|
||||
DeletedAt: profile.DeletedAt,
|
||||
Version: profile.Version,
|
||||
First_Name: profile.First_Name,
|
||||
Last_Name: profile.Last_Name,
|
||||
User_Name: profile.User_Name,
|
||||
Email: profile.Email,
|
||||
Password: profile.Password,
|
||||
Enabled: profile.Enabled,
|
||||
}
|
||||
return model
|
||||
}
|
||||
|
||||
func ConvertProfilesToDtos(profiles []Profile) []ProfileDTO {
|
||||
dtos := make([]ProfileDTO, len(profiles))
|
||||
for i, profile := range profiles {
|
||||
|
||||
Reference in New Issue
Block a user