This commit is contained in:
teddy
2025-04-18 15:10:49 +07:00
parent a0984902e0
commit f7db944b97
4 changed files with 95 additions and 67 deletions

23
query/query.go Normal file
View File

@@ -0,0 +1,23 @@
package query
import (
"email-notification/model"
"gorm.io/gorm"
)
func GetBirthday(db *gorm.DB, data *[]model.Birthday, month, day string) error {
return db.Table("user").
Where("status_id", 1).
Where("EXTRACT(MONTH FROM birthday) = ?", month).
Where("EXTRACT(DAY FROM birthday) = ?", day).
Find(&data).Error
}
func GetWorkanniversary(db *gorm.DB, data *[]model.Workanniversary, month, day string) error {
return db.Table("user").
Where("status_id", 1).
Where("EXTRACT(MONTH FROM hire_date) = ?", month).
Where("EXTRACT(DAY FROM hire_date) = ?", day).
Find(&data).Error
}