feat: user domain -- errors

This commit is contained in:
2025-09-02 16:38:12 +03:30
parent 5ea90d5c0e
commit 0e32d0d820
11 changed files with 195 additions and 1 deletions
View File
+38
View File
@@ -0,0 +1,38 @@
package entity
import (
"backend/pkg/validate/national"
"backend/pkg/validate/phone"
"time"
"github.com/google/uuid"
)
type User struct {
ID uuid.UUID
Name string
LastName string
PhoneNumber string
Email string
PubKey string
NationalID string
BirthDate time.Time // format YYYY-MM-DD in presentation
CreatedAt time.Time
UpdatedAt time.Time
}
func (u *User) ValidatePhoneNumber(phoneNumber string) error {
ok, err := phone.IsValid(phoneNumber)
if !ok {
return err
}
return nil
}
func (u *User) ValidateNationalID(ID string) error {
ok, err := national.IsValid(ID)
if !ok {
return err
}
return nil
}
View File
View File