mirror of
https://github.com/usual2970/certimate.git
synced 2025-08-13 12:51:45 +00:00
.github
.vscode
docker
internal
app
applicant
certificate
deployer
domain
notify
pkg
repository
access.go
acme_account.go
certificate.go
settings.go
statistics.go
workflow.go
workflow_output.go
rest
routes
scheduler
statistics
workflow
migrations
ui
.dockerignore
.editorconfig
.gitignore
.goreleaser.yml
CHANGELOG.md
CONTRIBUTING.md
CONTRIBUTING_EN.md
Dockerfile
LICENSE.md
Makefile
README.md
README_EN.md
go.mod
go.sum
main.go
nixpacks.toml
usage.gif
27 lines
649 B
Go
27 lines
649 B
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/usual2970/certimate/internal/app"
|
|
"github.com/usual2970/certimate/internal/domain"
|
|
)
|
|
|
|
type CertificateRepository struct{}
|
|
|
|
func NewCertificateRepository() *CertificateRepository {
|
|
return &CertificateRepository{}
|
|
}
|
|
|
|
func (c *CertificateRepository) ListExpireSoon(ctx context.Context) ([]domain.Certificate, error) {
|
|
certificates := []domain.Certificate{}
|
|
err := app.GetApp().Dao().DB().
|
|
NewQuery("SELECT * FROM certificate WHERE expireAt > DATETIME('now') AND expireAt < DATETIME('now', '+20 days')").
|
|
All(&certificates)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return certificates, nil
|
|
}
|