package models

type RaspEmailHistory struct {
	//Model
	Id   int64 `json:"id" gorm:"PRIMARY_KEY"`
	Addr string `json:"addr"`
	Date string `json:"date"`
	Error string `json:"error"`
}

func AddEmailHistory(rasp *RaspEmailHistory) error {
	return db.Create(rasp).Error
}

func CheckEmailToday(rasp *RaspEmailHistory)  bool {
	var email RaspEmailHistory
	return db.Model(&email).Where("addr = ? and date = ?",rasp.Addr,rasp.Date).First(&email).RecordNotFound()
}