feat: birthday validation integrated into profile
This commit is contained in:
@@ -35,6 +35,7 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgerrcode"
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@@ -437,9 +438,15 @@ func (a *authServiceImpl) RegistrationComplete(cinfo dto.ClientInfo, request mod
|
||||
return nil, errs.ErrServerError
|
||||
}
|
||||
|
||||
birthdayTimestamp := pgtype.Timestamp {
|
||||
Time: time.UnixMilli(request.Birthday),
|
||||
Valid: true,
|
||||
}
|
||||
|
||||
profile, err = db.TXQueries.CreateProfile(db.CTX, database.CreateProfileParams{
|
||||
UserID: user.ID,
|
||||
Name: request.Name,
|
||||
Birthday: birthdayTimestamp,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -126,7 +126,6 @@ func (p *profileServiceImpl) GetProfileSettings(cinfo dto.ClientInfo) (*dto.Prof
|
||||
return profileSettingsDto, nil
|
||||
}
|
||||
|
||||
// XXX: no validation for timestamps' allowed ranges
|
||||
func (p *profileServiceImpl) UpdateProfile(cinfo dto.ClientInfo, newProfile dto.NewProfileDto) (bool, error) {
|
||||
helper, db, err := database.NewDbHelperTransaction(p.dbctx); if err != nil {
|
||||
p.log.Error(
|
||||
|
||||
Reference in New Issue
Block a user