Skip to content

Commit

Permalink
fix: nullable time
Browse files Browse the repository at this point in the history
  • Loading branch information
litsynp committed Feb 16, 2024
1 parent 8f38daf commit 5c422b7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions internal/domain/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package user

import (
"context"
"database/sql"
"time"

pnd "github.com/pet-sitter/pets-next-door-api/api"
)
Expand All @@ -24,9 +26,9 @@ type User struct {
ProfileImageID *int `field:"profile_image_id"`
FirebaseProviderType FirebaseProviderType `field:"fb_provider_type"`
FirebaseUID string `field:"fb_uid"`
CreatedAt string `field:"created_at"`
UpdatedAt string `field:"updated_at"`
DeletedAt string `field:"deleted_at"`
CreatedAt time.Time `field:"created_at"`
UpdatedAt time.Time `field:"updated_at"`
DeletedAt sql.NullTime `field:"deleted_at"`
}

type UserWithProfileImage struct {
Expand All @@ -38,13 +40,13 @@ type UserWithProfileImage struct {
ProfileImageURL *string `field:"profile_image_url"`
FirebaseProviderType FirebaseProviderType `field:"fb_provider_type"`
FirebaseUID string `field:"fb_uid"`
CreatedAt string `field:"created_at"`
UpdatedAt string `field:"updated_at"`
DeletedAt string `field:"deleted_at"`
CreatedAt time.Time `field:"created_at"`
UpdatedAt time.Time `field:"updated_at"`
DeletedAt sql.NullTime `field:"deleted_at"`
}

func (u *UserWithProfileImage) ToUserWithoutPrivateInfo() *UserWithoutPrivateInfo {
if u.DeletedAt != "" {
if u.DeletedAt.Valid {
return &UserWithoutPrivateInfo{
ID: u.ID,
Nickname: "탈퇴한 사용자",
Expand Down

0 comments on commit 5c422b7

Please sign in to comment.