feat: Refactor User entity and datasource to use email and password hashing with salt

This commit is contained in:
2025-03-10 08:05:48 +00:00
parent f567d086ec
commit 3193204dac
9 changed files with 110 additions and 56 deletions
@@ -0,0 +1,6 @@
package dto
type AuthDto struct {
Email string `json:"email"`
Password string `json:"password"`
}
@@ -11,16 +11,15 @@ type UserDto struct {
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
LastEditorID ulid.ULID `json:"lastEditorID"`
Username string `json:"username"`
Password string `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
Email string `json:"email"`
Role string `json:"role"`
CompanyID int `json:"companyId"`
HourlyRate float64 `json:"hourlyRate"`
}
type UserCreateDto struct {
Username string `json:"username"`
Password string `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
Email string `json:"email"`
Password string `json:"password"`
Role string `json:"role"`
CompanyID int `json:"companyId"`
HourlyRate float64 `json:"hourlyRate"`
@@ -31,8 +30,8 @@ type UserUpdateDto struct {
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
LastEditorID *ulid.ULID `json:"lastEditorID"`
Username *string `json:"username"`
Password *string `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
Email *string `json:"email"`
Password *string `json:"password"`
Role *string `json:"role"`
CompanyID *int `json:"companyId"`
HourlyRate *float64 `json:"hourlyRate"`