services

package
v0.0.0-...-f242362 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUserID

func CheckUserID(id uint) (*models.User, error)

CheckUserID ユーザー登録チェック

func CreateReminderSettingWithRelation

func CreateReminderSettingWithRelation(db *gorm.DB, userID uint, name, notifyTitle, notifyText string, cycleDays uint, basisDate time.Time) (*models.ReminderSetting, error)

CreateReminderSettingWithRelation リマインド設定と紐付くリマインド予定を作成 basisDate 起点日付 *基本的にはtime.Now()を指定する事になる

func CreateReminderSettingWithRelationInTransact

func CreateReminderSettingWithRelationInTransact(db *gorm.DB, userID uint, name, notifyTitle, notifyText string, cycleDays uint, basisDate time.Time) error

CreateReminderSettingWithRelationInTransact リマインド設定と紐付くリマインド予定をトランザクション作成 basisDate 起点日付 *基本的にはtime.Now()を指定する事になる

func DeleteReminderSettingByUserIDAndNumber

func DeleteReminderSettingByUserIDAndNumber(db *gorm.DB, userID, number uint) error

DeleteReminderSettingByUserIDAndNumber リマインダー設定削除

func GetAuthCodeURLWithSessionKey

func GetAuthCodeURLWithSessionKey(key string) string

GetAuthCodeURLWithSessionKey 確認キーを渡しつつAuth接続先URL取得

func GetDB

func GetDB() *gorm.DB

GetDB DB接続取得

func GetOauthInfo

func GetOauthInfo(code string) (*v2.Tokeninfo, error)

GetOauthInfo OAUTHにより情報を取得

func GetReminderSettingByUserIDAndNumber

func GetReminderSettingByUserIDAndNumber(db *gorm.DB, UserID, number uint) (*models.ReminderSetting, error)

GetReminderSettingByUserIDAndNumber リマインド設定取得

func GetSettingAndScheduleByScheduleIDAndUserID

func GetSettingAndScheduleByScheduleIDAndUserID(db *gorm.DB, scheduleID, userID uint) (*models.ReminderSetting, *models.ReminderSchedule, error)

GetSettingAndScheduleByScheduleIDAndUserID

func GetUserIDOrCreateUserID

func GetUserIDOrCreateUserID(email string) (uint, error)

GetUserIDOrCreateUserID 登録Eメールが有ればUserIdを取得、無ければ登録してUserIDを取得

func IsSuccessStatusCode

func IsSuccessStatusCode(response *rest.Response) bool

IsSuccessStatusCode 成功ステータスコードか?

func RandString

func RandString(n int) string

RandString ランダムに指定文字数分の文字列を生成する

func ResetReminderScheduleAfterNotify

func ResetReminderScheduleAfterNotify(db *gorm.DB, rSet models.ReminderSetting, basisDate time.Time) error

ResetReminderScheduleAfterNotify メール通知完了後の次回通知予定設定 basisDate 起点日付 *基本的にはtime.Now()を指定する事になる

func SendMail

func SendMail(toEmail, subject, content string) (*rest.Response, error)

SendMail 送信内容バリデーションしてEメール送信

func UpdateReminderSettingByUserIDAndNumber

func UpdateReminderSettingByUserIDAndNumber(db *gorm.DB, userID, number uint, name, notifyTitle, notifyText string, cycleDays uint) (*models.ReminderSetting, error)

UpdateReminderSettingByUserIDAndNumber リマインド設定変更

Types

type Message

type Message struct {
	ToEmail string `validate:"required,email"`
	Subject string `validate:"required,max=100"`
	Content string `validate:"required,max=1000"`
}

Message is struct

type NotifyDetail

type NotifyDetail struct {
	Email       string
	SettingID   uint
	ScheduleID  uint
	NotifyTitle string
	NotifyText  string
}

NotifyDetail 通知内容詳細

func GetRemindersReachedNotifyDate

func GetRemindersReachedNotifyDate(db *gorm.DB, targetDate time.Time, reminderScheduleID uint, limit int) ([]NotifyDetail, error)

GetRemindersReachedNotifyDate 通知日付に達した全リマインド予定の通知内容取得 メール通知処理等で利用

func (NotifyDetail) Send

func (notifyDetail NotifyDetail) Send() error

Send メール送信し次回通知日付を更新

type ReminderDetail

type ReminderDetail struct {
	ID          uint
	CreatedAt   time.Time
	UpdatedAt   time.Time
	UserID      uint
	Number      uint
	Name        string
	NotifyTitle string
	NotifyText  string
	CycleDays   uint
	NotifyDate  time.Time
	ScheduleID  uint
}

ReminderDetail リマインド詳細

func GetReminderListByUserID

func GetReminderListByUserID(db *gorm.DB, userID uint, limit, offset int) ([]ReminderDetail, error)

GetReminderListByUserID ユーザー情報からリマインド一覧取得 リマインド一覧画面等で利用

Jump to

Keyboard shortcuts

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