service

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

サービス層

  • ドメインとリポジトリを利用してユースケースを実現する
  • 1ハンドラー1ユースケースとする

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteUser

type DeleteUser struct {
	Tx       repository.Beginner
	Cache    domain.Cache
	UserRepo domain.UserRepo
}

func NewDeleteUser

func NewDeleteUser(cache domain.Cache, repo domain.UserRepo, db *sqlx.DB) *DeleteUser

func (*DeleteUser) DeleteUser

func (du *DeleteUser) DeleteUser(ctx *gin.Context, userID model.UserID) error

ユーザー削除サービス

type GetAccount

type GetAccount struct {
	DB              repository.Queryer
	Repo            domain.UserRepo
	TransactionRepo domain.TransactionRepo
}

func NewGetAccount

func NewGetAccount(db *sqlx.DB, repo *repository.Repository) *GetAccount

func (*GetAccount) GetAccount

func (ga *GetAccount) GetAccount(ctx *gin.Context) (GetAccountResponse, error)

ユーザ一覧取得サービス

@params ctx コンテキスト

@return ユーザ一覧

type GetAccountResponse

type GetAccountResponse struct {
	ID               model.UserID
	FirstName        string
	FirstNameKana    string
	FamilyName       string
	FamilyNameKana   string
	Email            string
	AcquisitionPoint int
	SendablePoint    int
}

type GetNotification

type GetNotification struct {
	Tx        repository.Beginner
	Cache     domain.Cache
	NotifRepo domain.NotificationRepo
}

func NewGetNotification

func NewGetNotification(cache domain.Cache, repo *repository.Repository, db *sqlx.DB) *GetNotification

func (*GetNotification) GetNotification

func (gn *GetNotification) GetNotification(ctx *gin.Context, notificationID model.NotificationID) (GetNotificationResponse, error)

お知らせ詳細取得サービス

@params ctx コンテキスト @params notificationID お知らせID

@return お知らせ詳細

type GetNotificationResponse

type GetNotificationResponse struct {
	ID          model.NotificationID
	Title       string
	Description string
	IsChecked   bool
	CreatedAt   string
}

type GetNotifications

type GetNotifications struct {
	DB        repository.Queryer
	NotifRepo domain.NotificationRepo
	UserRepo  domain.UserRepo
}

func NewGetNotifications

func NewGetNotifications(db *sqlx.DB, repo *repository.Repository) *GetNotifications

func (*GetNotifications) GetNotifications

func (gn *GetNotifications) GetNotifications(ctx *gin.Context, nextToken, size string) (GetNotificationsResponse, error)

お知らせ一覧取得サービス

@params ctx コンテキスト

@return ユーザ一覧

type GetNotificationsResponse

type GetNotificationsResponse struct {
	Notifications []struct {
		ID          model.NotificationID
		Title       string
		Description string
		IsChecked   bool
		CreatedAt   string
	}
	NextToken string
}

type GetUncheckedNotificationCount

type GetUncheckedNotificationCount struct {
	DB        repository.Queryer
	Cache     domain.Cache
	NotifRepo domain.NotificationRepo
}

func NewGetUncheckedNotificationCount

func NewGetUncheckedNotificationCount(db *sqlx.DB, cache domain.Cache, repo domain.NotificationRepo) *GetUncheckedNotificationCount

func (*GetUncheckedNotificationCount) GetUncheckedNotificationCount

func (gunc *GetUncheckedNotificationCount) GetUncheckedNotificationCount(ctx *gin.Context) (<-chan int, error)

お知らせ数を確認し、かつ、お知らせ通知をサブスクライブ

@params ctx コンテキスト

@return ユーザ一覧

type GetUsers

type GetUsers struct {
	DB              repository.Queryer
	UserRepo        domain.UserRepo
	TransactionRepo domain.TransactionRepo
	TokenGenerator  domain.TokenGenerator
}

func NewGetUsers

func NewGetUsers(db *sqlx.DB, repo *repository.Repository, jwter domain.TokenGenerator) *GetUsers

func (*GetUsers) GetUsers

func (r *GetUsers) GetUsers(ctx context.Context, input GetUsersRequest) (GetUsersResponse, error)

ユーザ一覧取得サービス

@params ctx コンテキスト

@return ユーザ一覧

type GetUsersRequest

type GetUsersRequest struct {
	Size       int
	NextCursor string
}

type GetUsersResponse

type GetUsersResponse struct {
	Users []struct {
		ID               model.UserID
		FirstName        string
		FirstNameKana    string
		FamilyName       string
		FamilyNameKana   string
		Email            string
		AcquisitionPoint int
	}
	NextCursor string
}

type RegisterTemporaryUser

type RegisterTemporaryUser struct {
	DB    repository.Queryer
	Cache domain.Cache
	Repo  domain.UserRepo
}

func NewRegisterTemporaryUser

func NewRegisterTemporaryUser(db *sqlx.DB, rep domain.UserRepo, cache domain.Cache) *RegisterTemporaryUser

func (*RegisterTemporaryUser) RegisterTemporaryUser

func (r *RegisterTemporaryUser) RegisterTemporaryUser(ctx context.Context, firstName, firstNameKana, familyName, familyNameKana, email, password string) (string, error)

ユーザ仮登録サービス

@params ctx コンテキスト firstName 名前 firstNameKana 名前カナ familyName 名字 familyNameKana 名字カナ email メールアドレス password パスワード

@returns temporaryUserId 一時保存したユーザを識別するID

type RegisterUser

type RegisterUser struct {
	DB             repository.Execer
	Cache          domain.Cache
	Repo           domain.UserRepo
	TokenGenerator domain.TokenGenerator
}

func NewRegisterUser

func NewRegisterUser(db *sqlx.DB, rep domain.UserRepo, cache domain.Cache, jwter domain.TokenGenerator) *RegisterUser

func (*RegisterUser) RegisterUser

func (r *RegisterUser) RegisterUser(ctx context.Context, temporaryUserId, confirmCode string) (*entities.User, string, error)

ユーザ登録サービス

@params ctx コンテキスト, temporaryUserId 一時保存ユーザid

@return ユーザ情報

type ResetPassword

type ResetPassword struct {
	ExecerDB  repository.Execer
	QueryerDB repository.Queryer
	Repo      domain.UserRepo
}

func NewResetPassword

func NewResetPassword(db *sqlx.DB, rep domain.UserRepo) *ResetPassword

func (*ResetPassword) ResetPassword

func (rp *ResetPassword) ResetPassword(ctx context.Context, email string) error

パスワードリセットサービス

@params email メールアドレス

@returns error

type SendPoint

type SendPoint struct {
	PointRepo        domain.PointRepo
	UserRepo         domain.UserRepo
	NotificationRepo domain.NotificationRepo
	Tx               repository.Beginner
	Cache            domain.Cache
}

func NewSendPoint

func NewSendPoint(repo *repository.Repository, db *sqlx.DB, cache domain.Cache) *SendPoint

func (*SendPoint) SendPoint

func (sp *SendPoint) SendPoint(ctx *gin.Context, toUserId, sendPoint int) error

ポイント送信サービス

@params ctx コンテキスト toUserId 送付先ユーザーID sendPoint 送付ポイント

type Signin

type Signin struct {
	DB             repository.Queryer
	Cache          domain.Cache
	Repo           domain.UserRepo
	TokenGenerator domain.TokenGenerator
}

func NewSignin

func NewSignin(db *sqlx.DB, rep domain.UserRepo, cache domain.Cache, jwter domain.TokenGenerator) *Signin

func (*Signin) Signin

func (s *Signin) Signin(ctx context.Context, email, password string) (string, error)

サインインサービス

@params ctx コンテキスト email メール password パスワード

@return JWT

type Signout

type Signout struct {
	Cache domain.Cache
}

func NewSignout

func NewSignout(cache domain.Cache) *Signout

func (*Signout) Signout

func (s *Signout) Signout(ctx *gin.Context) error

サインアウトサービス

@params ctx コンテキスト uid ユーザーID

@return err

type UpdateAccount

type UpdateAccount struct {
	ExecerDB repository.Execer
	UserRepo domain.UserRepo
}

func NewUpdateAccount

func NewUpdateAccount(db *sqlx.DB, repo domain.UserRepo) *UpdateAccount

func (*UpdateAccount) UpdateAccount

func (ua *UpdateAccount) UpdateAccount(ctx *gin.Context, familyName, familyNameKana, firstName, firstNameKana string) error

アカウント情報更新サービス

@params ctx コンテキスト familyName 苗字 familyNameKana 苗字カナ firstName 名前 firstNameKana 名前カナ

type UpdateEmail

type UpdateEmail struct {
	ExecerDB  repository.Execer
	QueryerDB repository.Queryer
	Cache     domain.Cache
	UserRepo  domain.UserRepo
}

func NewUpdateEmail

func NewUpdateEmail(db *sqlx.DB, cache domain.Cache, rep domain.UserRepo) *UpdateEmail

func (*UpdateEmail) UpdateEmail

func (ue *UpdateEmail) UpdateEmail(ctx *gin.Context, temporaryEmailID, confirmCode string) error

メール本変更サービス

@params temporaryEmailID 一時保存メールアドレスID @params confirmCode 認証コード

@returns error

type UpdatePassword

type UpdatePassword struct {
	ExecerDB  repository.Execer
	QueryerDB repository.Queryer
	UserRepo  domain.UserRepo
}

func NewUpdatePassword

func NewUpdatePassword(db *sqlx.DB, repo domain.UserRepo) *UpdatePassword

func (*UpdatePassword) UpdatePassword

func (up *UpdatePassword) UpdatePassword(ctx *gin.Context, oldPassword, newPassword string) error

パスワード更新サービス

@params ctx コンテキスト oldPassword 古いパスワード newPassword 新しいパスワード

type UpdateTemporaryEmail

type UpdateTemporaryEmail struct {
	DB    repository.Queryer
	Cache domain.Cache
	Repo  domain.UserRepo
}

func NewUpdateTemporaryEmail

func NewUpdateTemporaryEmail(db *sqlx.DB, cache domain.Cache, rep domain.UserRepo) *UpdateTemporaryEmail

func (*UpdateTemporaryEmail) UpdateTemporaryEmail

func (ute *UpdateTemporaryEmail) UpdateTemporaryEmail(ctx *gin.Context, email string) (string, error)

メール仮登録サービス

@params ctx コンテキスト email メールアドレス

@returns temporaryEmailId 一時保存したメールを識別するID

Jump to

Keyboard shortcuts

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