users

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertPhoneNumber

func ConvertPhoneNumber(phoneNumber string) (bool, string)

func IsKatakana

func IsKatakana(str string) bool

func IsValidPostalCode

func IsValidPostalCode(postalCode string) (bool, string)

Types

type AddressRegisterPayload

type AddressRegisterPayload struct {
	FirstName     string `json:"first_name" binding:"required"`
	FirstNameKana string `json:"first_name_kana" binding:"required"`
	LastName      string `json:"last_name" binding:"required"`
	LastNameKana  string `json:"last_name_kana" binding:"required"`
	ZipCode       string `json:"zip_code" binding:"required"`
	Address1      string `json:"address_1" binding:"required"`
	Address2      string `json:"address_2" binding:"required"`
	Address3      string `json:"address_3"`
	PhoneNumber   string `json:"phone_number" binding:"required"`
}

type IRepository

type IRepository interface {
	Create(UserId string) error
	Get(UserId string) (user User, err error)
	Delete(UserId string) error
	UpdateProfile(string, map[string]interface{}) error
	RegisterAddress(string, AddressRegisterPayload) error
	UpdateAddress(string, map[string]interface{}) error
}

type IRequests

type IRequests interface {
	Create(userId string) error
	Get(userId string) (User, error)
	Delete(userId string) error
	ProfileUpdate(userId string, userProfile UserProfile) error
	AddressRegister(userId string, AddressRegisterPayload AddressRegisterPayload) error
	AddressUpdate(userId string, userAddress UserAddress) error
}

type IUtils

type IUtils interface {
	InspectAddressRegisterPayload(AddressRegisterPayload) (AddressRegisterPayload, error)
	InspectProfileUpdatePayload(UserProfile) map[string]interface{}
	InspectAddressUpdatePayload(UserAddress) (map[string]interface{}, error)
}

type Requests

type Requests struct {
	UserRepository IRepository
	UserUtils      IUtils
}

func (Requests) AddressRegister

func (r Requests) AddressRegister(userId string, AddressRegisterPayload AddressRegisterPayload) error

func (Requests) AddressUpdate

func (r Requests) AddressUpdate(userId string, userAddress UserAddress) error

func (Requests) Create

func (r Requests) Create(userId string) error

func (Requests) Delete

func (r Requests) Delete(userId string) error

func (Requests) Get

func (r Requests) Get(userId string) (User, error)

func (Requests) ProfileUpdate

func (r Requests) ProfileUpdate(userId string, userProfile UserProfile) error

type User

type User struct {
	UserId      string      `json:"user_id" gorm:"user_id"`
	UserProfile UserProfile `json:"profile" gorm:"profile"`
	UserAddress UserAddress `json:"address" gorm:"address"`
}

type UserAddress

type UserAddress struct {
	FirstName     string `json:"first_name" gorm:"first_name"`
	FirstNameKana string `json:"first_name_kana" gorm:"first_name_kana"`
	LastName      string `json:"last_name" gorm:"last_name"`
	LastNameKana  string `json:"last_name_kana" gorm:"last_name_kana"`
	ZipCode       string `json:"zip_code" gorm:"zip_code"`
	Address1      string `json:"address_1" gorm:"address_1"`
	Address2      string `json:"address_2" gorm:"address_2"`
	Address3      string `json:"address_3" gorm:"address_3"`
	PhoneNumber   string `json:"phone_number" gorm:"phone_number"`
}

type UserProfile

type UserProfile struct {
	DisplayName     string    `json:"display_name" gorm:"display_name"`
	Description     string    `json:"description" gorm:"description"`
	StripeAccountId string    `json:"stripe_account_id" gorm:"stripe_account_id"`
	CreatedAt       time.Time `json:"crated_at" gorm:"created_at"`
}

type UserProfileRegisterPayload

type UserProfileRegisterPayload struct {
	DisplayName string `json:"display_name" binding:"required"`
	Description string `json:"description" binding:"required"`
}

type UserRepository

type UserRepository struct {
	DB *gorm.DB
}

func (UserRepository) Create

func (r UserRepository) Create(UserId string) error

firstorinitをそのうち使うかもしれない

func (UserRepository) Delete

func (r UserRepository) Delete(UserId string) error

func (UserRepository) Get

func (r UserRepository) Get(UserId string) (user User, err error)

func (UserRepository) RegisterAddress

func (r UserRepository) RegisterAddress(UserId string, payload AddressRegisterPayload) error

func (UserRepository) UpdateAddress

func (r UserRepository) UpdateAddress(UserId string, payload map[string]interface{}) error

func (UserRepository) UpdateProfile

func (r UserRepository) UpdateProfile(UserId string, payload map[string]interface{}) error

type UserUtils

type UserUtils struct {
}

func (UserUtils) InspectAddressRegisterPayload

func (u UserUtils) InspectAddressRegisterPayload(address AddressRegisterPayload) (AddressRegisterPayload, error)

func (UserUtils) InspectAddressUpdatePayload

func (u UserUtils) InspectAddressUpdatePayload(address UserAddress) (map[string]interface{}, error)

func (UserUtils) InspectProfileUpdatePayload

func (u UserUtils) InspectProfileUpdatePayload(profile UserProfile) map[string]interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL